public override VectorData LoadElements(CullState cullState) { VectorElementVector elements = new VectorElementVector(); MapEnvelope mapViewBounds = cullState.GetProjectionEnvelope(this.Projection); MapPos min = mapViewBounds.Bounds.Min; MapPos max = mapViewBounds.Bounds.Max; // Run query here LoadData(elements, min, max, cullState.ViewState.Zoom); return(new VectorData(elements)); }
private bool DistanceCull(float nearestDistSquare, float farthestDistSquare, IStreamingResourceHandler handler) { bool allowExitAhead = true; // camera in this cell if (nearestDistSquare < 0) { for (int i = 0; i < Constants.DistCullingCatCount; i++) { if (_cullingState[i] != CullState.NotCulled) { _cullingState[i] = CullState.NotCulled; SetActivation(i, true, handler); } } allowExitAhead = false; } else { // 分若干种距离判断是否需要提前退出 for (int i = 0; i < Constants.DistCullingCatCount; i++) { if (_cullingCountOverall[i] != 0) { var standard = Constants.DistCullingCats[i].Dist; var cullStandard = _cullingState[i] == CullState.NotSure ? Constants.DistCullingCats[i].RedundantDist : standard; CullState state = CullState.NotSure; if (nearestDistSquare >= cullStandard) { state = CullState.Culled; } else if (farthestDistSquare < standard) { state = CullState.NotCulled; } // 结果为剔除,上次也为剔除,提前退出 // 结果为必可见,上次也为必可见,提前退出 if (_cullingState[i] != state || state == CullState.NotSure) { allowExitAhead = false; } // 状态变化时,处理可见性 if (_cullingState[i] != state) { _cullingState[i] = state; SetActivation(i, _cullingState[i] != CullState.Culled, handler); } } } } return(allowExitAhead); }
public void SetCullState(CullState cullstate) { this.cullState = cullstate; }