Пример #1
0
        public void Merge(TripSegment otherSegment)
        {
            var currentNumberOfPoints = this.NumberOfPoints;
            this.NumberOfPoints += otherSegment.NumberOfPoints;

            this.MaxSpeed = this.MaxSpeed > otherSegment.MaxSpeed ? this.MaxSpeed : otherSegment.MaxSpeed;
            this.MaxSatellites = this.MaxSatellites > otherSegment.MaxSatellites ? this.MaxSatellites : otherSegment.MaxSatellites;
            this.MaxRoll = this.MaxRoll > otherSegment.MaxRoll ? this.MaxRoll : otherSegment.MaxRoll;
            this.MaxPitch = this.MaxPitch > otherSegment.MaxPitch ? this.MaxPitch : otherSegment.MaxPitch;

            this.MaxTemperature = this.MaxTemperature > otherSegment.MaxTemperature ? this.MaxTemperature : otherSegment.MaxTemperature;
            this.MaxBmp = this.MaxBmp > otherSegment.MaxBmp ? this.MaxBmp : otherSegment.MaxBmp;
            this.MaxAccelerationX = this.MaxAccelerationX > otherSegment.MaxAccelerationX ? this.MaxAccelerationX : otherSegment.MaxAccelerationX;
            this.MaxAccelerationY = this.MaxAccelerationY > otherSegment.MaxAccelerationY ? this.MaxAccelerationY : otherSegment.MaxAccelerationY;
            this.MaxAccelerationZ = this.MaxAccelerationZ > otherSegment.MaxAccelerationZ ? this.MaxAccelerationZ : otherSegment.MaxAccelerationZ;

            this.AverageSpeed = ((this.AverageSpeed * currentNumberOfPoints)
                                    + otherSegment.AverageSpeed * otherSegment.NumberOfPoints)
                                   / (currentNumberOfPoints + otherSegment.NumberOfPoints);

            this.AverageSatellites = Convert.ToInt32((this.AverageSatellites * currentNumberOfPoints
                                    + otherSegment.AverageSatellites * otherSegment.NumberOfPoints)
                                   / (currentNumberOfPoints + otherSegment.NumberOfPoints));

            this.AverageRoll = ((this.AverageRoll * currentNumberOfPoints)
                                    + otherSegment.AverageRoll * otherSegment.NumberOfPoints)
                                   / (currentNumberOfPoints + otherSegment.NumberOfPoints);

            this.AveragePitch = ((this.AveragePitch * currentNumberOfPoints)
                                    + otherSegment.AveragePitch * otherSegment.NumberOfPoints)
                                   / (currentNumberOfPoints + otherSegment.NumberOfPoints);

            this.AverageTemperature = ((this.AverageTemperature * currentNumberOfPoints)
                                    + otherSegment.AverageTemperature * otherSegment.NumberOfPoints)
                                   / (currentNumberOfPoints + otherSegment.NumberOfPoints);

            this.AverageBmp = ((this.AverageBmp * currentNumberOfPoints)
                                    + otherSegment.AverageBmp * otherSegment.NumberOfPoints)
                                   / (currentNumberOfPoints + otherSegment.NumberOfPoints);

            this.AverageAccelerationX = ((this.AverageAccelerationX * currentNumberOfPoints)
                                     + otherSegment.AverageAccelerationX * otherSegment.NumberOfPoints)
                                    / (currentNumberOfPoints + otherSegment.NumberOfPoints);

            this.AverageAccelerationY = ((this.AverageAccelerationY * currentNumberOfPoints)
                                     + otherSegment.AverageAccelerationY * otherSegment.NumberOfPoints)
                                    / (currentNumberOfPoints + otherSegment.NumberOfPoints);

            this.AverageAccelerationZ = ((this.AverageAccelerationZ * currentNumberOfPoints)
                                     + otherSegment.AverageAccelerationZ * otherSegment.NumberOfPoints)
                                    / (currentNumberOfPoints + otherSegment.NumberOfPoints);

            this.AverageAltitude = ((this.AverageAltitude * currentNumberOfPoints)
                                    + otherSegment.AverageAltitude * otherSegment.NumberOfPoints)
                                   / (currentNumberOfPoints + otherSegment.NumberOfPoints);
        }
Пример #2
0
 public void CopyFrom(TripSegment existingSegment)
 {
     this.AverageAccelerationX = existingSegment.AverageAccelerationX;
     this.AverageAccelerationY = existingSegment.AverageAccelerationY;
     this.AverageAccelerationZ = existingSegment.AverageAccelerationZ;
     this.AverageBmp = existingSegment.AverageBmp;
     this.AveragePitch = existingSegment.AveragePitch;
     this.AverageRoll = existingSegment.AverageRoll;
     this.AverageSatellites = existingSegment.AverageSatellites;
     this.AverageSpeed = existingSegment.AverageSpeed;
     this.AverageTemperature = existingSegment.AverageTemperature;
     this.EndLatitude = existingSegment.EndLatitude;
     this.EndLongitude = existingSegment.EndLongitude;
     this.EndLocation = existingSegment.EndLocation;
     this.EndPartitionAndRow = existingSegment.EndPartitionAndRow;
     this.EndTimeStamp = existingSegment.EndTimeStamp;
     this.MaxAccelerationX = existingSegment.MaxAccelerationX;
     this.MaxAccelerationY = existingSegment.MaxAccelerationY;
     this.MaxAccelerationZ = existingSegment.MaxAccelerationZ;
     this.MaxBmp = existingSegment.MaxBmp;
     this.MaxPitch = existingSegment.MaxPitch;
     this.MaxRoll = existingSegment.MaxRoll;
     this.MaxSatellites = existingSegment.MaxSatellites;
     this.MaxSpeed = existingSegment.MaxSpeed;
     this.MaxTemperature = existingSegment.MaxTemperature;
     this.NumberOfPoints = existingSegment.NumberOfPoints;
     this.StartLongitude = existingSegment.StartLongitude;
     this.StartLocation = existingSegment.StartLocation;
     this.AverageAltitude = existingSegment.AverageAltitude;
 }