private MapResourceItem CreateMapResourceItem(MapService mapService) { Logger.Debug("Creating map resource item for service=" + mapService.ServiceName); GISResourceItemDefinition definition = new GISResourceItemDefinition(); definition.DataSourceType = Properties.DataSourceType; definition.DataSourceDefinition = Properties.DataSourceDefinition; definition.Identity = Properties.Identity; definition.ResourceDefinition = "(default)@" + mapService.ServiceName; definition.DataSourceShared = true; MapResourceItem resourceItem = new MapResourceItem(); resourceItem.Definition = definition; resourceItem.Name = mapService.DisplayName; resourceItem.DisplaySettings = new DisplaySettings(); resourceItem.DisplaySettings.Visible = mapService.Visible; resourceItem.Parent = MapResourceManager; return resourceItem; }
/// <summary> /// Creates a GraphicsResource in the MapResourceManager. /// This must be the first layer to be created on the web-tier. /// </summary> public void AddGraphicsLayer() { GISResourceItemDefinition graphicsDefinition = new GISResourceItemDefinition(); graphicsDefinition.ResourceDefinition = "GraphicsResource"; graphicsDefinition.DataSourceDefinition = "In Memory"; graphicsDefinition.DataSourceType = "GraphicsLayer"; graphicsDefinition.DataSourceShared = true; MapResourceItem graphicsResourceItem = new MapResourceItem(); graphicsResourceItem.Definition = graphicsDefinition; graphicsResourceItem.Name = Properties.GraphicsResourceName; graphicsResourceItem.DisplaySettings = new DisplaySettings(); graphicsResourceItem.DisplaySettings.Visible = true; graphicsResourceItem.DisplaySettings.DisplayInTableOfContents = false; graphicsResourceItem.Parent = MapResourceManager; MapResourceManager.ResourceItems.Add(graphicsResourceItem); MapResourceManager.CreateResource(graphicsResourceItem); MapResourceManager.Refresh(); }