private void TryApplyDefaultBackgroudLayer(bool isUseDefaultBackgroudLayer) { if (!isUseDefaultBackgroudLayer) { return; } string fname = AppDomain.CurrentDomain.BaseDirectory + @"数据引用\基础矢量\矢量模版\海陆模版.shp"; if (!File.Exists(fname)) { Console.WriteLine("文件\"" + fname + "\"未找到,无法应用默认背景。"); return; } IBackgroundLayer lyr = null; if (_interestRegions == null || _interestRegions.Length == 0) { lyr = new BackgroundLayer(fname); } else { lyr = new BackgroundLayer(fname, _interestRegions); } (lyr as BackgroundLayer).LandColor = _landColor; (lyr as BackgroundLayer).SeaColor = _seaColor; _canvasHost.Canvas.LayerContainer.Layers.Add(lyr); }
public void SyncAttrbutes() { if (_provider == null) { return; } IBackgroundLayer bkLayer = GetBackgroundLayer(); if (bkLayer == null) { return; } _isUseDefaultBackgroudLayer = false; BackgroundLayer lyr = bkLayer as BackgroundLayer; if (lyr != null) { _seaColor = lyr.SeaColor; _landColor = lyr.LandColor; _interestRegions = lyr.InterestRegions; } _isUseDefaultBackgroudLayer = true; }