车辆监控地图部分
This commit is contained in:
+16
@@ -28,6 +28,17 @@
|
||||
///各个点权重设置,取值1-5,5最大。权重为5则不对此点做抽稀。格式为:{weight:indices}
|
||||
@property (nonatomic, strong) NSDictionary<NSNumber*, NSArray*> *pointsWeight;
|
||||
|
||||
///当前在手动拖动进度条
|
||||
@property (nonatomic, assign) BOOL isManualSlider;
|
||||
|
||||
/// 当前轨迹绘制进程
|
||||
@property (nonatomic, copy) void(^renderProgressHandler)(CGFloat progress);
|
||||
|
||||
/**
|
||||
* @brief 指定车辆当前位置
|
||||
*/
|
||||
- (void)specifyVehicleLocation:(CGFloat)value;
|
||||
|
||||
/**
|
||||
* @brief 重置为初始状态
|
||||
*/
|
||||
@@ -49,6 +60,11 @@
|
||||
*/
|
||||
- (BOOL)setWithCoordinates:(CLLocationCoordinate2D *)coords count:(NSInteger)count;
|
||||
|
||||
/**
|
||||
* @brief 获取所有的点数
|
||||
*/
|
||||
- (NSInteger)getOrigPointCount;
|
||||
|
||||
/**
|
||||
* @brief 获取当前car所在位置点索引
|
||||
*/
|
||||
|
||||
+19
-7
@@ -86,6 +86,14 @@ typedef struct MATraceReplayPoint MATraceReplayPoint;
|
||||
_readyForDrawing = NO;
|
||||
}
|
||||
|
||||
- (void)specifyVehicleLocation:(CGFloat)value {
|
||||
self.isPaused = YES;
|
||||
NSInteger locationIndex = (NSInteger)(_origPointCount - 1) * value;
|
||||
_carIndexInOrigArray = locationIndex;
|
||||
_multiPolyline.drawStyleIndexes = nil;
|
||||
_readyForDrawing = NO;
|
||||
}
|
||||
|
||||
- (BOOL)setWithPoints:(MAMapPoint *)points count:(NSInteger)count {
|
||||
if(points == NULL || count <= 0) {
|
||||
if (_origMapPoints != NULL) {
|
||||
@@ -214,6 +222,10 @@ typedef struct MATraceReplayPoint MATraceReplayPoint;
|
||||
[self recalculateMapPoints];
|
||||
}
|
||||
|
||||
- (NSInteger)getOrigPointCount {
|
||||
return _origPointCount;
|
||||
}
|
||||
|
||||
- (NSInteger)getOrigPointIndexOfCar {
|
||||
return _carIndexInOrigArray;
|
||||
}
|
||||
@@ -352,19 +364,19 @@ typedef struct MATraceReplayPoint MATraceReplayPoint;
|
||||
}
|
||||
_reducedPointIndexOfCar = ret;
|
||||
|
||||
//更新polyline的drawIndex
|
||||
if(_carIndexInOrigArray == 0) {
|
||||
_multiPolyline.drawStyleIndexes = nil;
|
||||
//更新patchline
|
||||
[_patchLine setPolylineWithPoints:NULL count:0];
|
||||
} else {
|
||||
// //更新polyline的drawIndex
|
||||
// if(_carIndexInOrigArray == 0) {
|
||||
// _multiPolyline.drawStyleIndexes = nil;
|
||||
// //更新patchline
|
||||
// [_patchLine setPolylineWithPoints:NULL count:0];
|
||||
// } else {
|
||||
_multiPolyline.drawStyleIndexes = @[@(_reducedPointIndexOfCar + 1)];
|
||||
|
||||
//更新patchline
|
||||
_patchLinePoints[0] = _carMapPoint;
|
||||
_patchLinePoints[1] = p2;
|
||||
[_patchLine setPolylineWithPoints:_patchLinePoints count:2];
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
if(!_readyForDrawing) {
|
||||
|
||||
Generated
+8
-1
@@ -53,7 +53,7 @@ typedef struct _MADrawPoint {
|
||||
_patchLineRender = [[MAPolylineRenderer alloc] initWithPolyline:[traceOverlay getPatchPolyline]];
|
||||
_patchLineRender.strokeColor = _proxyRender.strokeColors.lastObject;
|
||||
|
||||
_carImage = [UIImage dd_imageNamed:@"DDMAMap/my_location" bundleName:@"DDMAMapKit_Private" aClass:[self class]];
|
||||
_carImage = [UIImage dd_imageNamed:@"car_xingshi" bundleName:@"DDMAMapKit_Private" aClass:[self class]];
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -80,6 +80,12 @@ typedef struct _MADrawPoint {
|
||||
[traceOverlay drawStepWithTime:curTime - _prevTime zoomLevel:zoomLevel];
|
||||
_prevTime = curTime;
|
||||
}
|
||||
|
||||
if (!traceOverlay.isManualSlider) {
|
||||
if (traceOverlay.renderProgressHandler) {
|
||||
traceOverlay.renderProgressHandler((CGFloat)[traceOverlay getOrigPointIndexOfCar] / [traceOverlay getOrigPointCount]);
|
||||
}
|
||||
}
|
||||
|
||||
if(self.carImage && [traceOverlay getMultiPolyline].pointCount > 0) {
|
||||
[_proxyRender glRender];
|
||||
@@ -131,6 +137,7 @@ typedef struct _MADrawPoint {
|
||||
|
||||
- (void)reset {
|
||||
_prevTime = 0;
|
||||
[self setNeedsUpdate];
|
||||
}
|
||||
|
||||
- (void)renderCarImage {
|
||||
|
||||
Reference in New Issue
Block a user