Mercurial Hosting > traffic-intelligence
comparison trafficintelligence/moving.py @ 1136:30171d4fd3df Tertuis-Ou-draogo/movingpy-issue-22-from-etienne-beauchamp-1584900380975
moving.py [Issue #22 from Etienne Beauchamp In annotationTool Correction]
author | Tertuis Ouédraogo <tertuis95@gmail.com> |
---|---|
date | Sun, 22 Mar 2020 18:06:22 +0000 |
parents | 342701cdac30 |
children | b219d5a1bb55 |
comparison
equal
deleted
inserted
replaced
1135:342701cdac30 | 1136:30171d4fd3df |
---|---|
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: |