protected override void OnLoad(EventArgs e) { //Anytime we work with the Maestro API, we require an IServerConnection //reference. The Maestro.Login.LoginDialog provides a UI to obtain such a //reference. //If you need to obtain an IServerConnection reference programmatically and //without user intervention, use the ConnectionProviderRegistry class var login = new Maestro.Login.LoginDialog(); if (login.ShowDialog() == DialogResult.OK) { _conn = login.Connection; //Connections carry a capability property that tells you what is and isn't supported. //Here we need to check if this connection supports the IDrawingService interface. If //it doesn't we can't continue. if (Array.IndexOf(_conn.Capabilities.SupportedServices, (int)ServiceType.Drawing) < 0) { MessageBox.Show("This particular connection does not support the Drawing Service API"); Application.Exit(); return; } //For any non-standard service interface, we call GetService() passing in the service type and casting //it to the required service interface. _dwSvc = (IDrawingService)_conn.GetService((int)ServiceType.Drawing); } else //This sample does not work without an IServerConnection { Application.Exit(); } }
public SectionInfoCtrl(IDrawingService drawSvc, string drawingSourceId, OSGeo.MapGuide.ObjectModels.Common.DrawingSectionListSection section) : this() { _drawSvc = drawSvc; _drawingSourceId = drawingSourceId; _section = section; }
public StructureService(OpenLDContext context, IDrawingService drawingService, IViewService viewService, IMapper mapper) { _context = context; _drawingService = drawingService; _viewService = viewService; _mapper = mapper; }
public MailService(IAuthenticationService authService, IProfileService profileService, IDrawingService drawingService, ILogger logger) { AuthService = authService; Logger = logger; ProfileService = profileService; DrawingService = drawingService; }
static void Main(string[] args) { var DI = new InjectInterfaces(); service = DI.Start(); string excecuteComand = ""; do { string[] command = Console.ReadLine().Split(' '); if (service.ValidateCommand(command)) { Input input = service.FormatInput(command); excecuteComand = input.Command.ToUpper(); if (service.ExcecuteCommand(input)) { Console.Write(service.GetFinalCanvasAsString()); } } else { Console.WriteLine("Invalid Command"); } } while (excecuteComand != Command.Quit); }
public DrawingController(IDrawingService drawingService, ILabelService labelService, IRiggedFixtureService rFixtureService, IStructureService structureService, ITemplateService templateService, IViewService viewService) { _drawingService = drawingService; _structureService = structureService; _templateService = templateService; _authUtils = new AuthUtils(drawingService, labelService, rFixtureService, structureService, viewService); }
public SectionInfoCtrl(IDrawingService drawSvc, string drawingSourceId, OSGeo.MapGuide.ObjectModels.Common.DrawingSectionListSection section) : this() { _drawSvc = drawSvc; _drawingSourceId = drawingSourceId; _section = section; }
public PlayController(IGameService gameService, IDrawingService drawingService, IMapper mapper, UserManager <User> userManager) { this.gameService = gameService; this.drawingService = drawingService; this.mapper = mapper; this.userManager = userManager; }
public AuthUtils(IDrawingService drawingService, ILabelService labelService, IRiggedFixtureService rFixtureService, IStructureService structureService, IViewService viewService) { _drawingService = drawingService; _labelService = labelService; _rFixtureService = rFixtureService; _structureService = structureService; _viewService = viewService; }
public DrawingController(IFilterService filterService, IDrawingService drawingService, IProjectService projectService) { _filterService = filterService; _drawingService = drawingService; _projectService = projectService; }
private static async Task StartDemoAsync(IDrawingService drawingService) { var lines = new IDrawingPrimitive[] { new LinePrimitive(VectorPosition.FromCentimeters(1, 1), VectorPosition.FromCentimeters(2, 2)) }; await drawingService.DrawAsync(new RandomPrimitive(-1)); }
public UpdateDrawingHandler(IHandler handler, IDrawingService drawingService, IBusPublisher busPublisher, ILogger <UpdateDrawingHandler> logger) { _handler = handler; _drawingService = drawingService; _logger = logger; _busPublisher = busPublisher; }
public GameSetupService(ICharacterService characterService, IDrawingRepository drawingRepository, IPrintService printService, IDrawingService drawingService, IGameRepository gameRepository) { _characterService = characterService; _printService = printService; _drawingRepository = drawingRepository; _drawingService = drawingService; _gameRepository = gameRepository; }
public StoriesService(IAuthenticationService authService, IDatabaseService databaseService, IDrawingService drawingService, ILogger logger, IProfileService profileService) { AuthService = authService; DatabaseService = databaseService; DrawingService = drawingService; Logger = logger; ProfileService = profileService; }
public Builder(IMovementService _movementService, IGridService _gridService, IDrawingService _drawingService) { gridService = _gridService; movementService = _movementService; drawingService = _drawingService; gridService.SetNewGrid(); mainGrid = gridService.mainGrid; drawingService.PrintTable(mainGrid); }
//public MapCapture MapCapture { get; } #region Constructor public SnapRestrictionService(IAppContext context, IDrawingService drawingService) { _context = context ?? throw new ArgumentNullException("context"); _drawingService = drawingService ?? throw new ArgumentNullException("drawingService"); _map = _context.Map as IMap; //MapCapture = new MapCapture(_map as MapControl); activeRestrictions = new List <IRestriction>(); }
public DrawingHub(IDrawingService drawingService, IFixtureService fixtureService, ILabelService labelService, IRiggedFixtureService rFixtureService, IStructureService structureService, IUserService userService, IViewService viewService) { _drawingService = drawingService; _fixtureService = fixtureService; _labelService = labelService; _rFixtureService = rFixtureService; _structureService = structureService; _userService = userService; _viewService = viewService; _authUtils = new AuthUtils(drawingService, labelService, rFixtureService, structureService, viewService); }
public ScheduleUpdatedHandler(IHandler handler, IBusPublisher busPublisher, ILogger <ScheduleUpdatedHandler> logger, IDateEstimatorProvider dateEstimatorProvider, IScheduleRepository scheduleRepository, IDrawingService drawingService) { _handler = handler; _busPublisher = busPublisher; _logger = logger; _dateEstimatorProvider = dateEstimatorProvider; _scheduleRepository = scheduleRepository; _drawingService = drawingService; }
public RollingFinishedHandler(IHandler handler, IDrawingService drawingService, IDrawingRepository drawingRepository, IBusPublisher busPublisher, IDomainEventDispatcher domainEventDispatcher, ILogger <RollingFinished> logger) { _handler = handler; _drawingService = drawingService; _drawingRepository = drawingRepository; _busPublisher = busPublisher; _domainEventDispatcher = domainEventDispatcher; _logger = logger; }
public ShutdownDisabledHandler(IDrawingService drawingService, IScheduleRepository scheduleRepository, IHandler handler, IDateEstimatorProvider dateEstimatorProvider, IBusPublisher busPublisher, ILogger <ShutdownDisabledHandler> logger, DrawingSettings drawingSettings) { _drawingService = drawingService; _handler = handler; _busPublisher = busPublisher; _dateEstimatorProvider = dateEstimatorProvider; _scheduleRepository = scheduleRepository; _logger = logger; _drawingSettings = drawingSettings; }
public CharacterService(ILoggerFactory loggerFactory, IPrintService printService, IGlobalItemsProvider globalItemsProvider, IDrawingRepository drawingRepository, IDrawingService drawingService, IClassRepository classRepository, IPlayerRepository playerRepository) { _logger = loggerFactory.CreateLogger <CharacterService>(); _printService = printService; _globalItemsProvider = globalItemsProvider; _drawingRepository = drawingRepository; _drawingService = drawingService; _classRepository = classRepository; _playerRepository = playerRepository; }
public Editor(IAuthenticationService authService, IDrawingService drawingService, IAchievementsService achievementsService, IToastsService toastsService, IExportService exportService) { AuthService = authService; DrawingService = drawingService; AchievementsService = achievementsService; ToastsService = toastsService; ExportService = exportService; }
public DrawingServiceTests() { this.db = DbGenerator.GetDbContext(); DbSeeder.SeedNormalUsers(this.db); DbSeeder.SeedGames(this.db); var imageService = new Mock <IImageService>(); imageService .Setup(s => s.SaveGameDrawing(It.IsAny <string>(), It.IsAny <int>(), It.IsAny <string>())) .Returns(() => Task.FromResult(ImageUrl)); this.drawingService = new DrawingService(this.db, imageService.Object); }
public GameService(ILoggerFactory loggerFactory, IPrintService printService, IGlobalItemsProvider globalItemsProvider, IDrawingRepository drawingRepository, IDrawingService drawingService, IGameSetupService gameSetupService, IGameRepository gameRepository, ICombatService combatService, IInputProcessingService inputProcessingService, IPlayerRepository playerRepository) { _logger = loggerFactory.CreateLogger <GameService>(); _printService = printService; _globalItemsProvider = globalItemsProvider; _drawingRepository = drawingRepository; _drawingService = drawingService; _gameRepository = gameRepository; _combatService = combatService; _playerRepository = playerRepository; _inputProcessingService = inputProcessingService; Player = gameSetupService.Setup(); Game = _gameRepository.LoadGame(Player.GameSaveName); }
private void ExtractSymbol(string targetFolder, IDrawingService drawSvc, IDrawingSource ds, ObjCommon.DrawingSectionListSection sect, ObjCommon.DrawingSectionResourceListSectionResource res) { using (var rs = drawSvc.GetSectionResource(ds.ResourceID, res.Href)) { using (Image img = Image.FromStream(rs)) { string targetId = targetFolder + sect.Title + "." + ResourceTypes.SymbolDefinition.ToString(); string dataName = sect.Title + "." + GetImageFormat(img.RawFormat); var symDef = Utility.CreateSimpleSymbol(_conn, sect.Title, "Image symbol definition extracted from a Symbol Library by Maestro"); //NOXLATE var imgGraphics = symDef.CreateImageGraphics(); symDef.AddGraphics(imgGraphics); imgGraphics.Item = symDef.CreateImageReference(string.Empty, Utility.FdoStringifiyLiteral(dataName)); //Empty resource id = self reference imgGraphics.SizeScalable = "True"; //NOXLATE imgGraphics.ResizeControl = Utility.FdoStringifiyLiteral("ResizeNone"); //NOXLATE imgGraphics.Angle = "0.0"; //NOXLATE imgGraphics.PositionX = "0.0"; //NOXLATE imgGraphics.PositionY = "4.0"; //NOXLATE imgGraphics.SizeX = PxToMillimeters(img.Width).ToString(CultureInfo.InvariantCulture); imgGraphics.SizeY = PxToMillimeters(img.Height).ToString(CultureInfo.InvariantCulture); symDef.PointUsage = symDef.CreatePointUsage(); symDef.PointUsage.Angle = "%ROTATION_ANGLE%"; //NOXLATE var rotParam = symDef.CreateParameter(); rotParam.DataType = "String"; //NOXLATE rotParam.Identifier = "ROTATION_ANGLE"; //NOXLATE rotParam.DisplayName = "Angle to rotate symbol"; //NOXLATE rotParam.DefaultValue = "0.0"; //NOXLATE symDef.ParameterDefinition.AddParameter(rotParam); _conn.ResourceService.SaveResourceAs(symDef, targetId); using (var ms = new MemoryStream()) { img.Save(ms, ImageFormat.Png); ms.Position = 0L; //Rewind _conn.ResourceService.SetResourceData(targetId, dataName, ObjCommon.ResourceDataType.File, ms); } Trace.TraceInformation("Extracted symbol: " + targetId); } } }
/// <summary> /// Extracts the specified symbols to the given folder /// </summary> /// <param name="targetFolder"></param> /// <param name="symbols"></param> /// <param name="progressCallback"></param> public void ExtractSymbols(string targetFolder, IEnumerable <string> symbols, Action <int, int> progressCallback) { Check.ArgumentNotEmpty(targetFolder, nameof(targetFolder)); Check.ThatArgumentIsFolder(targetFolder, nameof(targetFolder)); if (symbols == null) { ExtractSymbols(targetFolder); } else { IDrawingService drawSvc = (IDrawingService)_conn.GetService((int)ServiceType.Drawing); IDrawingSource ds = PrepareSymbolDrawingSource(_conn, _symbolLibId); //Each section in the symbols.dwf represents a symbol var sectionList = drawSvc.EnumerateDrawingSections(ds.ResourceID); var symbolNames = new HashSet <string>(symbols); int processed = 0; foreach (var sect in sectionList.Section) { var sectResources = drawSvc.EnumerateDrawingSectionResources(ds.ResourceID, sect.Name); if (!symbolNames.Contains(sect.Title)) { continue; } foreach (var res in sectResources.SectionResource) { if (res.Role.ToUpper() == StringConstants.Thumbnail.ToUpper()) { ExtractSymbol(targetFolder, drawSvc, ds, sect, res); processed++; if (progressCallback != null) { progressCallback(processed, symbolNames.Count); } } } } } }
/// <summary> /// Regenerates the sheet list in this drawing source. /// </summary> /// <param name="source"></param> /// <returns>True if sheets were regenerated. False otherwise</returns> public static bool RegenerateSheetList(this IDrawingSource source) { Check.NotNull(source, "source"); Check.NotNull(source.CurrentConnection, "source.CurrentConection"); //NOXLATE Check.NotEmpty(source.ResourceID, "source.ResourceID"); //NOXLATE IDrawingService dwSvc = (IDrawingService)source.CurrentConnection.GetService((int)ServiceType.Drawing); var sheets = dwSvc.EnumerateDrawingSections(source.ResourceID); bool bRegen = sheets.Section.Count > 0; source.RemoveAllSheets(); if (bRegen) { foreach (var sht in sheets.Section) { source.AddSheet(source.CreateSheet(sht.Name, 0, 0, 0, 0)); } } return(bRegen); }
/// <summary> /// Regenerates the sheet list in this drawing source. /// </summary> /// <param name="source">The drawing source</param> /// <param name="conn">The server connection</param> /// <returns>True if sheets were regenerated. False otherwise</returns> public static bool RegenerateSheetList(this IDrawingSource source, IServerConnection conn) { Check.ArgumentNotNull(source, nameof(source)); Check.ArgumentNotNull(conn, nameof(conn)); Check.ArgumentNotEmpty(source.ResourceID, $"{nameof(source)}.{nameof(source.ResourceID)}"); IDrawingService dwSvc = (IDrawingService)conn.GetService((int)ServiceType.Drawing); var sheets = dwSvc.EnumerateDrawingSections(source.ResourceID); bool bRegen = sheets.Section.Count > 0; source.RemoveAllSheets(); if (bRegen) { foreach (var sht in sheets.Section) { source.AddSheet(source.CreateSheet(sht.Name, 0, 0, 0, 0)); } } return(bRegen); }
public override IResource CreateItem(string startPoint, IServerConnection conn) { using (var picker = new ResourcePicker(conn, ResourceTypes.DrawingSource.ToString(), ResourcePickerMode.OpenResource)) { picker.SetStartingPoint(startPoint); if (picker.ShowDialog() == System.Windows.Forms.DialogResult.OK) { var ldf = ObjectFactory.CreateDefaultLayer(OSGeo.MapGuide.ObjectModels.LayerDefinition.LayerType.Drawing, new Version(1, 0, 0)); ldf.SubLayer.ResourceId = picker.ResourceID; var dl = ((IDrawingLayerDefinition)ldf.SubLayer); dl.LayerFilter = string.Empty; dl.MinScale = 0; IDrawingService dwSvc = (IDrawingService)conn.GetService((int)ServiceType.Drawing); var sheets = dwSvc.EnumerateDrawingSections(picker.ResourceID); dl.Sheet = sheets.Section[0].Name; return(ldf); } return(null); } }
/// <summary> /// Creates an image-based Symbol Definition in the specified folder for each image symbol in the Symbol Library. /// /// Any existing resource names are overwritten /// </summary> /// <param name="targetFolder"></param> public void ExtractSymbols(string targetFolder) { Check.ArgumentNotEmpty(targetFolder, nameof(targetFolder)); Check.ThatPreconditionIsMet(ResourceIdentifier.IsFolderResource(targetFolder), $"{nameof(ResourceIdentifier)}.{nameof(ResourceIdentifier.IsFolderResource)}({nameof(targetFolder)})"); IDrawingService drawSvc = (IDrawingService)_conn.GetService((int)ServiceType.Drawing); IDrawingSource ds = PrepareSymbolDrawingSource(_conn, _symbolLibId); //Each section in the symbols.dwf represents a symbol var sectionList = drawSvc.EnumerateDrawingSections(ds.ResourceID); foreach (var sect in sectionList.Section) { var sectResources = drawSvc.EnumerateDrawingSectionResources(ds.ResourceID, sect.Name); foreach (var res in sectResources.SectionResource) { if (res.Role.ToUpper() == StringConstants.Thumbnail.ToUpper()) { ExtractSymbol(targetFolder, drawSvc, ds, sect, res); } } } }
protected override void OnLoad(EventArgs e) { //This call is a one-time only call that will instantly register all known resource //version types and validators. This way you never have to manually reference a //ObjectModels assembly of the desired resource type you want to work with ModelSetup.Initialize(); //Anytime we work with the Maestro API, we require an IServerConnection //reference. The Maestro.Login.LoginDialog provides a UI to obtain such a //reference. //If you need to obtain an IServerConnection reference programmatically and //without user intervention, use the ConnectionProviderRegistry class var login = new Maestro.Login.LoginDialog(); if (login.ShowDialog() == DialogResult.OK) { _conn = login.Connection; //Connections carry a capability property that tells you what is and isn't supported. //Here we need to check if this connection supports the IDrawingService interface. If //it doesn't we can't continue. if (Array.IndexOf(_conn.Capabilities.SupportedServices, (int)ServiceType.Drawing) < 0) { MessageBox.Show("This particular connection does not support the Drawing Service API"); Application.Exit(); return; } //For any non-standard service interface, we call GetService() passing in the service type and casting //it to the required service interface. _dwSvc = (IDrawingService)_conn.GetService((int)ServiceType.Drawing); } else //This sample does not work without an IServerConnection { Application.Exit(); } }
public UserController(IUserService userService, IDrawingService drawingService) { _userService = userService; _drawingService = drawingService; }
public ViewController(IDrawingService drawingService, ILabelService labelService, IRiggedFixtureService rFixtureService, IStructureService structureService, IViewService viewService) { _viewService = viewService; _authUtils = new AuthUtils(drawingService, labelService, rFixtureService, structureService, viewService); }