Mercurial Hosting > traffic-intelligence
comparison trafficintelligence/moving.py @ 1137:e9c12982ed28
Merged in Wendlasida/trafficintelligence-1/Tertuis-Ou-draogo/movingpy-issue-22-from-etienne-beauchamp-1584900380975 (pull request #20)
moving.py [Issue #22 from Etienne Beauchamp In annotationTool Correction]
Approved-by: Tertuis Ouédraogo <tertuis95@gmail.com>
author | Nicolas Saunier <nicolas.saunier@polymtl.ca> |
---|---|
date | Sun, 22 Mar 2020 18:57:39 +0000 |
parents | 30171d4fd3df |
children | b219d5a1bb55 |
comparison
equal
deleted
inserted
replaced
1135:342701cdac30 | 1137:e9c12982ed28 |
---|---|
1248 | 1248 |
1249 @staticmethod | 1249 @staticmethod |
1250 def croppedTimeInterval(obj, value, after = True): | 1250 def croppedTimeInterval(obj, value, after = True): |
1251 newTimeInterval = TimeInterval(obj.getFirstInstant(), min(value, obj.getLastInstant())) if after else TimeInterval(max(obj.getFirstInstant(), value), obj.getLastInstant()) | 1251 newTimeInterval = TimeInterval(obj.getFirstInstant(), min(value, obj.getLastInstant())) if after else TimeInterval(max(obj.getFirstInstant(), value), obj.getLastInstant()) |
1252 if obj.positions is not None : | 1252 if obj.positions is not None : |
1253 newPositions = obj.positions[slice(newTimeInterval.first, newTimeInterval.last+1)] | 1253 newPositions = obj.positions[slice(newTimeInterval.first - obj.getLastInstant(), newTimeInterval.last + 1 - obj.getLastInstant())] |
1254 else: | 1254 else: |
1255 newPositions = None | 1255 newPositions = None |
1256 if obj.velocities is not None : | 1256 if obj.velocities is not None : |
1257 newVelocities = obj.velocities[slice(newTimeInterval.first, newTimeInterval.last+1)] | 1257 newVelocities = obj.velocities[slice(newTimeInterval.first - obj.getLastInstant(), newTimeInterval.last + 1 - obj.getLastInstant())] |
1258 else: | 1258 else: |
1259 newVelocities = None | 1259 newVelocities = None |
1260 if obj.hasFeatures(): | 1260 if obj.hasFeatures(): |
1261 newFeatures = [f.croppedTimeInterval(value, after) for f in obj.features] | 1261 newFeatures = [f.croppedTimeInterval(value, after) for f in obj.features] |
1262 else: | 1262 else: |