private MgdRenderingOptions CreateRenderingOptions(MgViewerRenderingOptions renderOpts) { if (null == _lastRenderOpts) { _lastRenderOpts = new MgdRenderingOptions(renderOpts.Format, renderOpts.Behavior, renderOpts.Color); } else { var color = _lastRenderOpts.GetSelectionColor(); if (!(color.Red == renderOpts.Color.Red && color.Green == renderOpts.Color.Green && color.Blue == renderOpts.Color.Blue && color.Alpha == renderOpts.Color.Alpha && _lastRenderOpts.GetBehavior() == renderOpts.Behavior && _lastRenderOpts.GetImageFormat() == renderOpts.Format)) { _lastRenderOpts = new MgdRenderingOptions(renderOpts.Format, renderOpts.Behavior, renderOpts.Color); } } return _lastRenderOpts; }
public abstract MgByteReader RenderDynamicOverlay(MgSelectionBase selection, MgViewerRenderingOptions args);
private void UpdateSelectionRenderingOptions() { var value = this.SelectionColor; if (_selectionRenderOpts != null) { var color = _selectionRenderOpts.Color; if (color != null && (color.Red != value.R || color.Green != value.G || color.Blue != value.B)) { _selectionRenderOpts = null; _selectionRenderOpts = CreateSelectionRenderingOptions(value.R, value.G, value.B); //Trace.TraceInformation("Selection color updated to ({0}, {1}, {2})", value.R, value.G, value.B); } } }
/// <summary> /// Initializes this viewer with the specified viewer provider, if the provider contains a map /// it will load that as well. Otherwise a call to <see cref="LoadMap"/> is required afterwards /// </summary> /// <param name="provider">The provider.</param> public void Init(MgMapViewerProvider provider) { if (_agfRW == null) _agfRW = new MgAgfReaderWriter(); if (_wktRW == null) _wktRW = new MgWktReaderWriter(); if (_geomFact == null) _geomFact = new MgGeometryFactory(); _provider = provider; if (_resSvc != null) //Forward looking, dispose the existing one as it may be of a different implementation { _resSvc.Dispose(); _resSvc = null; } _resSvc = (MgResourceService)_provider.CreateService(MgServiceType.ResourceService); _overlayRenderOpts = CreateMapRenderingOptions(0, 0, 255); _selectionRenderOpts = CreateSelectionRenderingOptions(0, 0, 255); if (_provider != null) { _provider.MapLoaded -= OnMapSetOnProvider; _provider = null; } _provider = provider; _provider.MapLoaded += OnMapSetOnProvider; var map = _provider.GetMap(); if (map != null) OnMapSetOnProvider(this, EventArgs.Empty); }
public override OSGeo.MapGuide.MgByteReader RenderDynamicOverlay(OSGeo.MapGuide.MgSelectionBase selection, MgViewerRenderingOptions args) { return _renderSvc.RenderDynamicOverlay(_implMap, selection as MgdSelection, CreateRenderingOptions(args)); }