/// <summary>
 /// Creates an new instance of the command
 /// </summary>
 /// <param name="sceneContent">The content of the scene</param>
 protected StorageOperationsStageCommandBase(ISceneContent sceneContent) : base(sceneContent)
 {
     _stageDataAdapter = CreateDataAdapter();
     BusinessManager   = new StageBusinessManager(_stageDataAdapter);
     StageFilesFilter  = string.Format("{0} (*{1})|*{1}|{2} (*.*)|*.*", Resources.Title_Stage_files,
                                       Constants.Stage.ArchiveFileExtension, Resources.Title_All_files);
 }
 /// <summary>
 /// Creates an new instance of the command
 /// </summary>
 /// <param name="sceneContent">The content of the scene</param>
 protected StorageOperationsStageCommandBase(ISceneContent sceneContent): base(sceneContent)
 {
     _stageDataAdapter = CreateDataAdapter();
     BusinessManager = new StageBusinessManager(_stageDataAdapter);
     StageFilesFilter = string.Format("{0} (*{1})|*{1}|{2} (*.*)|*.*", Resources.Title_Stage_files, 
                                     Constants.Stage.ArchiveFileExtension, Resources.Title_All_files);
 }
 private static void AddToStage(ISceneEntity sceneEntity, ISceneContent sceneContent)
 {
     if (sceneContent.Stage == null)
     {
         throw new InvalidOperationException(Resources.Title_Add_The_stage_of_the_scene_is_not_initialized);
     }
     sceneContent.Stage.Add(sceneEntity);
 }
Esempio n. 4
0
        /// <summary>
        /// Build ethe new instance of the viewport
        /// </summary>
        /// <param name="sceneContent"></param>
        public SceneViewportModel(ISceneContent sceneContent)
        {
            SceneResizeEnabled = false;
            var sceneEngine = sceneContent.SceneEngine;

            Viewport            = sceneEngine.CreateViewport();
            Viewport.FPSEnabled = true;
            InitViewportContextMenu(sceneEngine.Cameras);
        }
        /// <summary>
        /// Add a new <see cref="SceneElement" /> to the stage
        /// </summary>
        /// <param name="sceneContent">The content of the scene.</param>
        /// <param name="x">The translation X of the scene element.</param>
        /// <param name="y">The translation Y of the scene element.</param>
        /// <param name="z">The translation Z of the scene element.</param>
        /// <param name="name">The name of the scene element.</param>
        public void AddSceneElementInSpace <T>(ISceneContent sceneContent, int x, int y, int z, string name)
            where T : ISceneEntity, new()
        {
            var sphereEntity = new T {
                Name = name
            };

            SetTransformationWhenApplicable(x, y, z, sphereEntity);
            AddToStage(sphereEntity, sceneContent);
        }
Esempio n. 6
0
 public void Init()
 {
     ClearSelectedSceneElementsResult();
     _sceneEngineMock = new Mock <ISceneEngine>();
     _stage           = new Stage();
     _sceneContent    = new SceneContent(_sceneEngineMock.Object);
     _sceneContent.SelectedSceneElementsChanged += (sender, entities) =>
     {
         _receivedSelectedSceneElements   = entities;
         _selectedSceneEntitiesEventFired = true;
     };
 }
 public void Init()
 {
     ClearSelectedSceneElementsResult();
     _sceneEngineMock = new Mock<ISceneEngine>();
     _stage = new Stage();
     _sceneContent = new SceneContent(_sceneEngineMock.Object);
     _sceneContent.SelectedSceneElementsChanged += (sender, entities) =>
     {
         _receivedSelectedSceneElements = entities;
         _selectedSceneEntitiesEventFired = true;
     };
 }
        /// <summary>
        /// Import of the 3D model from the file to the scene
        /// </summary>
        /// <param name="name">he name of the entity in the scene</param>
        /// <param name="fullFileName">Path to the file with 3D model</param>
        /// <param name="sceneContent">The content of the scene</param>
        public IActionResult Import3DModel(string name, string fullFileName, ISceneContent sceneContent)
        {
            var actionResult = ServiceLocator.Get <GeometryImportersPool>()
                               .GetWavefrontFormatImporter()
                               .LoadGeometry(fullFileName, sceneContent.SceneEngine);

            if (!actionResult.Success)
            {
                return(actionResult);
            }
            var sceneEntity = new CustomEntity {
                Name = name, Geometry = actionResult.Value
            };

            AddToStage(sceneEntity, sceneContent);
            return(actionResult);
        }
 /// <summary>
 /// Initializes a new instance of the base command for scene content and scene objects related operations
 /// </summary>
 /// <param name="sceneContent"></param>
 protected CommandWithSceneContentBase(ISceneContent sceneContent)
 {
     SceneContent = sceneContent;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AddHollowCylinderCommand"/>
 /// </summary>
 /// <param name="sceneContent">The content of the scene.</param>
 public AddHollowCylinderCommand(ISceneContent sceneContent)
     : base(sceneContent)
 {
 }
 /// <summary>
 /// Creates an new instance of the command
 /// </summary>
 /// <param name="sceneContent">The content of the scene</param>
 public SaveStageCommand(ISceneContent sceneContent): base(sceneContent)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AddSceneObjectCommandBase" />
 /// </summary>
 /// <param name="sceneContent"></param>
 protected AddSceneObjectCommandBase(ISceneContent sceneContent): base(sceneContent)
 {
 }
Esempio n. 13
0
 /// <summary>
 /// Creates an new instance of the command
 /// </summary>
 /// <param name="sceneContent">The content of the scene</param>
 public SaveStageCommand(ISceneContent sceneContent) : base(sceneContent)
 {
 }
Esempio n. 14
0
 /// <summary>
 /// Creates an new instance of the command
 /// </summary>
 /// <param name="sceneContent">The content of the scene</param>
 public LoadStageCommand(ISceneContent sceneContent) : base(sceneContent)
 {
 }
Esempio n. 15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AddCubeCommand" />
 /// </summary>
 /// <param name="sceneContent">The content of the scene.</param>
 public AddCubeCommand(ISceneContent sceneContent) : base(sceneContent)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AddSphereCommand" />
 /// </summary>
 /// <param name="sceneContent"></param>
 public AddSphereCommand(ISceneContent sceneContent): base(sceneContent)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="StageContentViewModel" />
 /// </summary>
 /// <param name="sceneContent"></param>
 public StageContentViewModel(ISceneContent sceneContent)
 {
     SelectItemsCommand = new SelectSceneEntitiesCommand(sceneContent);
     sceneContent.StageChanged += (sender, stage) => Stage = stage;
     Stage = sceneContent.Stage;
 }
Esempio n. 18
0
 /// <summary>
 /// Creates a new view-model of content-view of the scene-entity
 /// </summary>
 /// <param name="sceneContent">The content of the scene</param>
 public SceneEntityContentViewModel(ISceneContent sceneContent)
 {
     sceneContent.SubscribeOnSelectedItems <TSceneEntity>(this);
     Title            = Resources.Title_Scene_Entity;
     TitleColumnWidth = 80;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AddSceneObjectCommandBase" />
 /// </summary>
 /// <param name="sceneContent"></param>
 protected AddSceneObjectCommandBase(ISceneContent sceneContent) : base(sceneContent)
 {
 }
Esempio n. 20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="StageContentViewModel" />
 /// </summary>
 /// <param name="sceneContent"></param>
 public StageContentViewModel(ISceneContent sceneContent)
 {
     SelectItemsCommand         = new SelectSceneEntitiesCommand(sceneContent);
     sceneContent.StageChanged += (sender, stage) => Stage = stage;
     Stage = sceneContent.Stage;
 }
 /// <summary>
 /// Creates an new instance of the command
 /// </summary>
 /// <param name="sceneContent">The content of the scene</param>
 public LoadStageCommand(ISceneContent sceneContent): base(sceneContent)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SelectSceneEntitiesCommand" />
 /// </summary>
 /// <param name="sceneContent">The content of the scene</param>
 public SelectSceneEntitiesCommand(ISceneContent sceneContent)
 {
     _sceneContent = sceneContent;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AddCubeCommand" />
 /// </summary>
 /// <param name="sceneContent">The content of the scene.</param>
 public AddCubeCommand(ISceneContent sceneContent): base(sceneContent)
 {
 }
 /// <summary>
 /// Initializes a new instance of the base command for scene content and scene objects related operations
 /// </summary>
 /// <param name="sceneContent"></param>
 protected CommandWithSceneContentBase(ISceneContent sceneContent)
 {
     SceneContent = sceneContent;
 }
 /// <summary>
 /// Build a new instance of the command
 /// </summary>
 /// <param name="sceneContent">Content od the scene</param>
 /// <param name="title"></param>
 public AddCameraCommand(ISceneContent sceneContent, string title) : base(sceneContent)
 {
     _title = title;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="Import3DModelCommand" />
 /// </summary>
 /// <param name="sceneContent"></param>
 public Import3DModelCommand(ISceneContent sceneContent)
     : base(sceneContent)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="Import3DModelViewModel" />
 /// </summary>
 /// <param name="sceneContent"></param>
 public Import3DModelViewModel(ISceneContent sceneContent)
 {
     OpenFileCommand = new OpenFileWith3DModelCommand(this);
     ImportCommand = new PerformImport3DModelCommand(this, sceneContent).AfterExecuteAction(OnCloseView);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="Import3DModelViewModel" />
 /// </summary>
 /// <param name="sceneContent"></param>
 public Import3DModelViewModel(ISceneContent sceneContent)
 {
     OpenFileCommand = new OpenFileWith3DModelCommand(this);
     ImportCommand   = new PerformImport3DModelCommand(this, sceneContent).AfterExecuteAction(OnCloseView);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AddCylinderCommand"/>
 /// </summary>
 /// <param name="sceneContent">The content of the scene.</param>
 public AddCylinderCommand(ISceneContent sceneContent)
     : base(sceneContent)
 {
 }
Esempio n. 30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SceneViewportViewModel" />
 /// </summary>
 /// <param name="sceneContent">The content of the scene</param>
 public SceneViewportViewModel(ISceneContent sceneContent)
 {
     _sceneViewportModel = new SceneViewportModel(sceneContent);
     _sceneViewportModel.ImageSourceUpdated += (s, e) => ImageSource = e.ImageSource;
 }
Esempio n. 31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AddSphereCommand" />
 /// </summary>
 /// <param name="sceneContent"></param>
 public AddSphereCommand(ISceneContent sceneContent) : base(sceneContent)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="AddSpurGearCommand"/>
 /// </summary>
 /// <param name="sceneContent">The content of the scene.</param>
 public AddSpurGearCommand(ISceneContent sceneContent)
     : base(sceneContent)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SceneViewportViewModel" />
 /// </summary>
 /// <param name="sceneContent">The content of the scene</param>
 public SceneViewportViewModel(ISceneContent sceneContent)
 {
     _sceneViewportModel = new SceneViewportModel(sceneContent);
     _sceneViewportModel.ImageSourceUpdated += (s, e) => ImageSource = e.ImageSource;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PerformImport3DModelCommand" />
 /// </summary>
 /// <param name="viewModel">Th view-model of the importing view</param>
 /// <param name="sceneContent">The content of the scene</param>
 public PerformImport3DModelCommand(Import3DModelViewModel viewModel, ISceneContent sceneContent)
 {
     _viewModel = viewModel;
     _sceneContent = sceneContent;
 }
Esempio n. 35
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AddSpurGearCommand"/>
 /// </summary>
 /// <param name="sceneContent">The content of the scene.</param>
 public AddSpurGearCommand(ISceneContent sceneContent)
     : base(sceneContent)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="Import3DModelCommand" />
 /// </summary>
 /// <param name="sceneContent"></param>
 public Import3DModelCommand(ISceneContent sceneContent)
     : base(sceneContent)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PerformImport3DModelCommand" />
 /// </summary>
 /// <param name="viewModel">Th view-model of the importing view</param>
 /// <param name="sceneContent">The content of the scene</param>
 public PerformImport3DModelCommand(Import3DModelViewModel viewModel, ISceneContent sceneContent)
 {
     _viewModel    = viewModel;
     _sceneContent = sceneContent;
 }