Exemplo n.º 1
0
        public XRayImage(ViewObject viewObject, StatusBarItems statusBarItems, History history, SysConfiguration SysConfig)
        {
            InitializeComponent();
            MainXRayView.Image.Visibility = System.Windows.Visibility.Hidden;

            m_MagnifierSettings.IsMagniferEnabled = false;
            m_MagnifierSettings.Radius            = 0;
            m_MagnifierSettings.MagnFactor        = 2.0;
            m_MagnifierSettings.AspectRatio       = 0;
            m_MaxDetectorsPerBoard = viewObject.MaxDetectorsPerBoard;
            m_bitsPerPixel         = viewObject.BitsPerPixel;
            m_ViewObject           = viewObject;
            m_statusBarItems       = statusBarItems;

            MainXRayView.Setup(viewObject, history, SysConfig);


            MainXRayView.adonerImageObject.measureAdorner.SamplingSpace = viewObject.SamplingSpace;
            MainXRayView.adonerImageObject.measureAdorner.SamplingSpeed = viewObject.SamplingSpeed;

            MainXRayView.Cursor            = Cursors.Hand;
            MainXRayView.Image.MouseMove  += new MouseEventHandler(Img_MouseMove);
            MainXRayView.Image.MouseLeave += new MouseEventHandler(Img_MouseLeave);

            MainXRayView.MagnifierDockPanel.SizeChanged         += new SizeChangedEventHandler(Magnifier_SizeChanged);
            MainXRayView.MagnifierDockPanel.MouseMove           += new MouseEventHandler(Magnifier_MouseMove);
            MainXRayView.MagnifierDockPanel.MouseLeftButtonDown += new MouseButtonEventHandler(Magnifier_MouseMove);
        }
Exemplo n.º 2
0
        public XRayImage (ViewObject viewObject, StatusBarItems statusBarItems, History history, SysConfiguration SysConfig)
        {
            InitializeComponent();
            MainXRayView.Image.Visibility = System.Windows.Visibility.Hidden;

            m_MagnifierSettings.IsMagniferEnabled = false;
            m_MagnifierSettings.Radius = 0;
            m_MagnifierSettings.MagnFactor = 2.0;
            m_MagnifierSettings.AspectRatio = 0;
            m_MaxDetectorsPerBoard = viewObject.MaxDetectorsPerBoard;
            m_bitsPerPixel = viewObject.BitsPerPixel;
            m_ViewObject = viewObject;
            m_statusBarItems = statusBarItems;

            MainXRayView.Setup(viewObject, history, SysConfig);   
            

            MainXRayView.adonerImageObject.measureAdorner.SamplingSpace = viewObject.SamplingSpace;
            MainXRayView.adonerImageObject.measureAdorner.SamplingSpeed = viewObject.SamplingSpeed;

            MainXRayView.Cursor = Cursors.Hand;
            MainXRayView.Image.MouseMove += new MouseEventHandler(Img_MouseMove);
            MainXRayView.Image.MouseLeave += new MouseEventHandler(Img_MouseLeave);

            MainXRayView.MagnifierDockPanel.SizeChanged += new SizeChangedEventHandler(Magnifier_SizeChanged);
            MainXRayView.MagnifierDockPanel.MouseMove += new MouseEventHandler(Magnifier_MouseMove);
            MainXRayView.MagnifierDockPanel.MouseLeftButtonDown += new MouseButtonEventHandler(Magnifier_MouseMove);
            
        }
Exemplo n.º 3
0
        private static void WriteViewObjectToXML(XmlWriter writer, ViewObject obj)
        {
            writer.WriteStartElement("ViewObject");

            //writer.WriteAttributeString("area", obj.m_Area.ToString());// Need?
            //writer.WriteAttributeString("star", obj.m_Layer.ToString());// Need?

            writer.WriteStartElement("Position");
            writer.WriteElementString("X", obj.Position.X.ToString(usa));
            writer.WriteElementString("Y", obj.Position.Y.ToString(usa));
            writer.WriteElementString("Z", obj.Position.Z.ToString(usa));
            writer.WriteEndElement();

            writer.WriteElementString("YRotation", obj.YRotation.ToString(usa));

            writer.WriteStartElement("Parameters");
            writer.WriteAttributeString("count", "3");
            for (int j = 0; j < 3; j++)
            {
                writer.WriteStartElement("Parameter");
                writer.WriteAttributeString("id", j.ToString());
                writer.WriteString(obj.Parameters[j].ToString());
                writer.WriteEndElement();
            }
            writer.WriteEndElement();

            writer.WriteEndElement();
        }
        public ActionResult Index()
        {
            UserSession model      = (UserSession)Session["UserSession"];
            ViewObject  viewObject = new ViewObject(model);

            return(View(viewObject));
        }
        public override void GetImage(ViewObject obj, Graphics grap)
        {
            CoupleDouble point = obj.Pos * scale + offset;
            CoupleDouble size  = obj.Size * scale;

            switch (obj.Name)
            {
            case "Ship":
                DrawShip(point, size, obj.RotateAngle, grap);
                break;

            case "Asteroid":
                DrawAsteroid(point, size, obj.RotateAngle, grap);
                break;

            case "Ufo":
                DrawUfo(point, size, obj.RotateAngle, grap);
                break;

            case "Exsplosion":
                DrawExplosion(point, size, obj.RotateAngle, grap);
                break;

            case "LaserBulet":
                DrawLaserBullet(point, size, obj.RotateAngle, grap);
                break;

            case "GunBullet":
                DrawGunBullet(point, size, obj.RotateAngle, grap);
                break;
            }
        }
Exemplo n.º 6
0
    public void init(FieldAreas field_areas)
    {
        m_FieldAreas = field_areas;

        m_ViewObjects = new ViewObject[m_FieldAreas.getFieldAreaCountMax()];
        for (int field_idx = 0; field_idx < m_ViewObjects.Length; field_idx++)
        {
            GameObject field_area_object = Instantiate(m_FieldAreaPrefab);
            BattleSceneUtil.setRide(field_area_object.transform, gameObject.transform);
            field_area_object.transform.localPosition = new Vector3(field_idx - (m_ViewObjects.Length - 1) * 0.5f, 0.0f, 0.0f);

            m_ViewObjects[field_idx]        = new ViewObject();
            m_ViewObjects[field_idx].m_Root = field_area_object;
            int card_count = m_FieldAreas.getFieldArea(0).getCardMaxCount();
            m_ViewObjects[field_idx].m_Cards = new GameObject[card_count];
            for (int card_idx = 0; card_idx < card_count; card_idx++)
            {
                m_ViewObjects[field_idx].m_Cards[card_idx] = field_area_object.transform.GetChild(card_idx).gameObject;
            }
            m_ViewObjects[field_idx].m_Boost        = field_area_object.transform.Find("Boost").gameObject;
            m_ViewObjects[field_idx].m_Full         = field_area_object.transform.Find("Full").gameObject;
            m_ViewObjects[field_idx].m_PanelBase    = field_area_object.transform.Find("PanelBase").gameObject;
            m_ViewObjects[field_idx].m_PanelSelect  = field_area_object.transform.Find("PanelSelect").gameObject;
            m_ViewObjects[field_idx].m_PanelRBase   = field_area_object.transform.Find("PanelRBase").gameObject;
            m_ViewObjects[field_idx].m_PanelRSelect = field_area_object.transform.Find("PanelRSelect").gameObject;
            m_ViewObjects[field_idx].m_Collision    = field_area_object.GetComponent <FieldCollision>();
        }
    }
Exemplo n.º 7
0
        protected virtual void ReadViewObject(XmlReader reader, Level level)
        {
            ViewObject obj = level.AddViewObject();

            while (reader.Read())
            {
                reader.MoveToContent();
                if (reader.NodeType.Equals(XmlNodeType.Element) && reader.LocalName.Equals("Position"))
                {
                    Vector3 position = ReadPositionVector3(reader);
                    obj.Position = position;
                }
                else if (reader.NodeType.Equals(XmlNodeType.Element) && reader.LocalName.Equals("YRotation"))
                {
                    float yRotation = Helper.ParseFloat(reader.ReadElementContentAsString());
                    obj.YRotation = yRotation;
                }
                else if (reader.NodeType.Equals(XmlNodeType.Element) && reader.LocalName.Equals("Parameters"))
                {
                    obj.Parameters = ReadParameters(reader, 3);
                }
                else if (reader.NodeType.Equals(XmlNodeType.EndElement) && reader.LocalName.Equals("ViewObject"))
                {
                    break;
                }
            }
        }
Exemplo n.º 8
0
        public ViewObject CreateViewObject(ViewObjectCreateArgs args)
        {
            ViewObject viewObject = new ViewObject(args.LinkedGameObject.UniqueIdentifier, args.LinkedGameObject.ObjectType, args.LinkedGameObject.IsLocalPlayer, args.LinkedGameObject.PlayerLinkedId);

            List <IViewableComponent> components = args.LinkedGameObject.GetViewableGameComponents().ToList();

            foreach (var component in components)
            {
                DeusViewComponent tmpComponent = null;
                switch (component.ComponentType)
                {
                case EComponentType.HealthComponent:
                    tmpComponent = new HealthViewComponent(component, component.UniqueIdentifier, args.LinkedGameObject.UniqueIdentifier);
                    break;

                case EComponentType.PositionComponent:
                    break;

                default:
                    break;
                }
                if (tmpComponent != null)
                {
                    viewObject.AddComponent(tmpComponent);
                }
            }

            return(viewObject);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Renders the Xray image on the CPU.
        /// </summary>
        /// <param name="bsource"></param>
        /// <param name="sourceObject"></param>
        /// <param name="viewObject"></param>
        /// <param name="xrayImageEffect"></param>
        /// <param name="trimatEffect"></param>
        /// <param name="effects"></param>
        /// <param name="displayWidth"></param>
        /// <param name="displayHeight"></param>
        /// <param name="adornerLayerManager"></param>
        /// <param name="displayAnnotations"></param>
        /// <param name="displayMeasurements"></param>
        /// <returns>The newly rendered bitmap.</returns>
        public static BitmapSource GetRenderedXrayImage(BitmapSource bsource,
                                                        SourceObject sourceObject,
                                                        ViewObject viewObject,
                                                        ShaderEffect xrayOrTrimateImageEffect,
                                                        List <Effect> effects,
                                                        double displayWidth,
                                                        double displayHeight,
                                                        AdornerLayerManager adornerLayerManager,
                                                        bool displayAnnotations,
                                                        bool displayMeasurements)
        {
            if (xrayOrTrimateImageEffect != null && xrayOrTrimateImageEffect.GetType() == typeof(XrayImageEffect))
            {
                RenderXrayImage_XRayImageEffect(ref bsource, (XrayImageEffect)xrayOrTrimateImageEffect, sourceObject);
            }
            //else if (xrayOrTrimateImageEffect.GetType() == typeof(TrimatEffect))
            //{
            //    RenderXrayImage_TrimatEffect(ref bsource, (TrimatEffect)xrayOrTrimateImageEffect, sourceObject, viewObject);
            //}
            foreach (Effect effect in effects)
            {
                ApplyEffectToBitmap(ref bsource, effect);
            }
            if (displayAnnotations)
            {
                RenderAnnotations(ref bsource, displayWidth, displayHeight, adornerLayerManager);
            }
            if (displayMeasurements)
            {
                RenderMeasurements(ref bsource, displayWidth, displayHeight, adornerLayerManager);
            }

            return(bsource);
        }
Exemplo n.º 10
0
        private void ManageViewObjectCreation(PacketCreateViewObject packet)
        {
            Console.WriteLine($"Create View Object | Id obj : {packet.LinkedGameObject.UniqueIdentifier} | Is local player : {packet.LinkedGameObject.IsLocalPlayer}");
            // Create our view object
            ViewObject viewObject = m_objectFactory.CreateViewObject(new ViewObjectCreateArgs(packet.LinkedGameObject));

            AddObject(viewObject);
        }
Exemplo n.º 11
0
        public ViewObject AddViewObject()
        {
            ViewObject obj = new ViewObject(
                InitialiseDataForObject(LevelObject.Type.VIEW), (int)GetNextUniqueID());

            m_LevelObjects.Add(obj.m_UniqueID, obj);
            return(obj);
        }
Exemplo n.º 12
0
        public override void Copy(ViewObject obj)
        {
            base.Copy(obj);
            var task = obj as ArchivedTask;
            if (task != null)
            {

            }
        }
		private void GoToSource(ViewObject obj)
		{
			var branch = obj.Object as BranchModel;
			var tag = obj.Object as TagModel;

			if (branch != null)
				ShowViewModel<SourceTreeViewModel>(new SourceTreeViewModel.NavObject { Username = Username, Repository = Repository, Branch = branch.Node });
			else if (tag != null)
				ShowViewModel<SourceTreeViewModel>(new SourceTreeViewModel.NavObject { Username = Username, Repository = Repository, Branch = tag.Node });
		}
Exemplo n.º 14
0
        public ViewObject AddViewObject()
        {
            IEnumerable <LevelObject> views = GetAllObjectsByType(LevelObject.Type.VIEW);
            int        maxid = (views.Count() < 1) ? -1 : views.Max(obj2 => ((ViewObject)obj2).m_ViewID);
            ViewObject obj   = new ViewObject(
                InitialiseDataForObject(LevelObject.Type.VIEW), (int)GetNextUniqueID(), maxid + 1);

            m_LevelObjects.Add(obj.m_UniqueID, obj);
            return(obj);
        }
Exemplo n.º 15
0
 public void AddViewToMap(ViewObject vo)
 {
     if (ViewMap.ContainsKey(vo.ID))
     {
         ViewMap[vo.ID] = vo;
     }
     else
     {
         ViewMap.Add(vo.ID, vo);
     }
 }
        public static void CheckForMovementCollision()
        {
            ViewObject secondFighterAction = GetFighterCurrentAction(BattlegroundController.SecondFighterActions);

            if (BattlegroundController.FirstFighter.Bounds.Contains(BattlegroundController.SecondFighter.Bounds))
            {
                BattlegroundController.FirstFighter.Move("collisionRight");

                BattlegroundController.SecondFighter.Move("collisionLeft");
            }
        }
Exemplo n.º 17
0
 private void View(ITriggerParameter value)
 {
     value = GetObjectPointer();
     if (value is ObjectInstance)
     {
         ViewObject?.Invoke((ObjectInstance)value);
     }
     if (value is Room)
     {
         ViewRoom?.Invoke((Room)value);
     }
 }
Exemplo n.º 18
0
 /// <summary>
 /// Returns boolean indicating if view-object is a UIView.
 /// </summary>
 private bool IsUIView(ViewObject viewObject)
 {
     if (viewObject == null || String.IsNullOrEmpty(viewObject.Name) || viewObject.Name == "View")
     {
         return(false);
     }
     if (viewObject.Name == "UIView")
     {
         return(true);
     }
     return(IsUIView(viewObject.BasedOn));
 }
Exemplo n.º 19
0
        private void ManageViewObjectUpdate(PacketUpdateViewObject packet)
        {
            ViewObject viewObject = m_holdedObjects.FirstOrDefault(vo => vo.UniqueIdentifier == packet.ObjectId);

            if (viewObject != null)
            {
                DeusViewComponent component = viewObject.Get(packet.ComponentId);
                if (component != null)
                {
                    component.UpdateViewValue(packet.NewValue);
                }
            }
        }
Exemplo n.º 20
0
		private void GoToSource(ViewObject obj)
		{
			if (obj.Object is BranchModel)
			{
				var x = obj.Object as BranchModel;
				ShowViewModel<SourceTreeViewModel>(new SourceTreeViewModel.NavObject { Username = Username, Repository = Repository, Branch = x.Name, TrueBranch = true });
			}
			else if (obj.Object is TagModel)
			{
				var x = obj.Object as TagModel;
				ShowViewModel<SourceTreeViewModel>(new SourceTreeViewModel.NavObject { Username = Username, Repository = Repository, Branch = x.Commit.Sha });
			}
		}
Exemplo n.º 21
0
 public void UpdateView(ViewObject view)
 {
     foreach (InputHandler ih in InputHandlers.Values)
     {
         if (view is CardView)
         {
             ih.Bridge.UpdateCardView((CardView)view);
         }
         else if (view is PlayerView)
         {
             ih.Bridge.UpdatePlayerView((PlayerView)view);
         }
     }
 }
Exemplo n.º 22
0
        public static Sprite GetSprite(ViewTypeId typeId, int width = 48, int height = 48)
        {
            var dictKey = new ViewKey(typeId, width, height);

            if (Sprites.TryGetValue(dictKey, out var sprite))
            {
                return(sprite);
            }

            ViewObject viewObject = ViewObjectsBase.Instance.GetViewObject(typeId);

            if (viewObject is SpriteObject spriteObject)
            {
                return(Sprites[dictKey] = spriteObject.sprite);
            }

            Texture2D texture;

            if (viewObject is AbstractLineObject lineObject)
            {
                texture = (Texture2D)lineObject.material.mainTexture;
                if (texture == null)
                {
                    texture = new Texture2D(1, 1, TextureFormat.ARGB32, false);
                    texture.SetPixel(0, 0, lineObject.material.color);
                    texture.Apply();
                }
            }
            else
            {
                RuntimePreviewGenerator.PreviewDirection = Vector3.forward;
                RuntimePreviewGenerator.BackgroundColor  = Color.clear;
                RuntimePreviewGenerator.OrthographicMode = true;

                var prefabObject     = (PrefabObject)viewObject;
                var withoutParticles = Object.Instantiate(prefabObject.gameObject);
                var particleSystems  = withoutParticles.GetComponentsInChildren <ParticleSystem>();
                foreach (var particleSystem in particleSystems)
                {
                    Object.DestroyImmediate(particleSystem);
                }
                texture = RuntimePreviewGenerator.GenerateModelPreview(withoutParticles.transform, width, height);
                Object.DestroyImmediate(withoutParticles);
            }

            Rect rect = new Rect(0, 0, texture.width, texture.height);

            return(Sprites[dictKey] = Sprite.Create(texture, rect, Vector2.zero, 100));
        }
        private static ViewObject GetFighterCurrentAction(Dictionary <string, ViewObject> actions)
        {
            ViewObject currentAction = actions["Stand"];

            foreach (var action in actions)
            {
                if (action.Value.ToBeDrawn == true)
                {
                    currentAction = action.Value;
                    break;
                }
            }

            return(currentAction);
        }
Exemplo n.º 24
0
 private void GoToSource(ViewObject obj)
 {
     if (obj.Object is BranchModel)
     {
         var x = obj.Object as BranchModel;
         ShowViewModel <SourceTreeViewModel>(new SourceTreeViewModel.NavObject {
             Username = Username, Repository = Repository, Branch = x.Name, TrueBranch = true
         });
     }
     else if (obj.Object is TagModel)
     {
         var x = obj.Object as TagModel;
         ShowViewModel <SourceTreeViewModel>(new SourceTreeViewModel.NavObject {
             Username = Username, Repository = Repository, Branch = x.Commit.Sha
         });
     }
 }
Exemplo n.º 25
0
        private void GoToSource(ViewObject obj)
        {
            var branch = obj.Object as BranchModel;
            var tag    = obj.Object as TagModel;

            if (branch != null)
            {
                ShowViewModel <SourceTreeViewModel>(new SourceTreeViewModel.NavObject {
                    Username = Username, Repository = Repository, Branch = branch.Node
                });
            }
            else if (tag != null)
            {
                ShowViewModel <SourceTreeViewModel>(new SourceTreeViewModel.NavObject {
                    Username = Username, Repository = Repository, Branch = tag.Node
                });
            }
        }
Exemplo n.º 26
0
        protected virtual void WriteViewObjectToXML(XmlWriter writer, ViewObject obj)
        {
            writer.WriteStartElement("ViewObject");

            WriteObjectPositionToXML(writer, obj);

            writer.WriteElementString("YRotation", Helper.ToString(obj.YRotation));

            writer.WriteStartElement("Parameters");
            writer.WriteAttributeString("count", "3");
            for (int j = 0; j < 3; j++)
            {
                writer.WriteStartElement("Parameter");
                writer.WriteAttributeString("id", j.ToString());
                writer.WriteString(obj.Parameters[j].ToString());
                writer.WriteEndElement();
            }
            writer.WriteEndElement();

            writer.WriteEndElement();
        }
Exemplo n.º 27
0
        public override void GetImage(ViewObject obj, Graphics grap)
        {
            CoupleDouble point = obj.Pos * scale + offset;
            CoupleDouble size  = obj.Size * scale;

            Bitmap   ship         = new Bitmap(32, 32);
            Graphics shipGraphics = Graphics.FromImage(ship);

            Rectangle shipRectangle = new Rectangle(0, 0, 32, 32);

            string name  = obj.Name;
            Image  image = null;

            _sourcesList.Images.TryGetValue(name, out image);

            Brush shipBrush = null != image? new TextureBrush(image) : Brushes.Black;

            shipGraphics.FillRectangle(shipBrush, shipRectangle);

            grap.DrawImage(ship, RotatingRectangle.GetPoints(point, size, obj.RotateAngle));
        }
Exemplo n.º 28
0
        public List <ViewObject> Tick(List <UserAction> actions)
        {
            Entitys.AddRange(Interactions());
            Entitys.AddRange(ShipState(actions));
            List <ViewObject> output = new List <ViewObject>();

            foreach (AEntity entity in Entitys)
            {
                if ((entity.WasKilled == true))
                {
                    if (entity.GetEntityType() == EntityType.Enemy)
                    {
                        ViewObject explosion = entity.GetViewObject();
                        explosion.Name = "Exsplosion";
                        output.Add(explosion);
                        Score++;
                    }
                }
                else
                {
                    output.Add(entity.GetViewObject());
                }
            }
            Entitys.RemoveAll(x => x.WasKilled);

            if (!Loose())
            {
                output.Add(new ViewObject("Ship", playerShip.Pos, playerShip.Size, playerShip.Direction));
                foreach (IWeapon weapon in playerShip.Weapons)
                {
                    weapon.Update();
                }
            }
            else
            {
                PlayerLoose(this, new LooseEventArgs(Score));
            }

            return(output);
        }
Exemplo n.º 29
0
        public XRayImage(ViewObject viewObject, StatusBarItems statusBarItems, History history, SysConfiguration SysConfig)
        {
            InitializeComponent();
            CultureResources.registerDataProvider(this);

            m_MagnifierSettings.IsMagniferEnabled = false;
            m_MagnifierSettings.Radius            = 0;
            m_MagnifierSettings.MagnFactor        = 2.0;
            m_MagnifierSettings.AspectRatio       = 0;
            m_MaxDetectorsPerBoard = viewObject.MaxDetectorsPerBoard;
            m_bitsPerPixel         = viewObject.BitsPerPixel;
            m_ViewObject           = viewObject;
            m_statusBarItems       = statusBarItems;

            XRayView_ContextMenu.Opened += new RoutedEventHandler(XRayView_ContextMenu_Changed);
            XRayView_ContextMenu.Closed += new RoutedEventHandler(XRayView_ContextMenu_Changed);

            MainXRayView.Setup(viewObject, history, SysConfig);

            MainXRayView.Cursor = Cursors.Hand;
            MainXRayView.MainImage.MouseMove  += new MouseEventHandler(Img_MouseMove);
            MainXRayView.MainImage.MouseLeave += new MouseEventHandler(Img_MouseLeave);

            MainXRayView.Magnifier_Panel.SizeChanged         += new SizeChangedEventHandler(Magnifier_SizeChanged);
            MainXRayView.Magnifier_Panel.MouseMove           += new MouseEventHandler(Magnifier_MouseMove);
            MainXRayView.Magnifier_Panel.MouseLeftButtonDown += new MouseButtonEventHandler(Magnifier_MouseMove);

            if (viewObject.TIPMarkings != null)
            {
                HideFTILocations();

                //foreach (Rect rect in viewObject.TIPMarkings)
                //{
                //    MainXRayView.adonerImageObject.TIPAdorner.Add(rect);
                //}
            }

            MainXRayView.AlgServerRequestEvent += new AlgServerRequestEventHandler(MainXRayView_AlgServerRequestEvent);
        }
Exemplo n.º 30
0
        public void Dispose()
        {
            CultureResources.getDataProvider().DataChanged -= this.CultureResources_DataChanged;
            HistoryList.IsOpen = false;

            PseudoColor_ComboBox.Items.Clear();
            PseudoColor_ComboBox = null;

            m_Filters.Clear();
            m_Filters = null;

            m_FilterManager.Dispose();
            m_FilterManager = null;

            m_SourceObject = null;
            m_History      = null;

            PanAndZoomControl.Content = null;
            PanAndZoomControl         = null;

            m_ViewObject.Dispose();
            m_ViewObject = null;
        }
Exemplo n.º 31
0
        public void SetupActions(List <GameAction> actions)
        {
            //Setup
            SelectedAction         = null;
            AvailableActions       = actions;
            bOK.Enabled            = false;
            bCancel.Enabled        = false;
            grpPlayer1.ContextMenu = null;
            grpPlayer2.ContextMenu = null;

            ContextMap.Clear();

            foreach (GameAction ga in AvailableActions)
            {
                if (ga.AssociatedGameObjectID == -1)
                {
                    bOK.Enabled = true;
                    continue;
                }
                if (ga.AssociatedGameObjectID == -2)
                {
                    bCancel.Enabled = true;
                    continue;
                }

                ViewObject vo = ViewMap[ga.AssociatedGameObjectID];
                if (vo is CardView)
                {
                    ContextMenuStrip cont;
                    if (ContextMap.ContainsKey(vo.ID))
                    {
                        cont = ContextMap[vo.ID];
                    }
                    else
                    {
                        cont = new ContextMenuStrip();
                    }
                    ToolStripMenuItem tsmi = new ToolStripMenuItem(ga.Description);
                    tsmi.Click += (o, e) => { SelectedAction = ga; };
                    cont.Items.Add(tsmi);
                    ContextMap.Add(vo.ID, cont);
                }
                else if (vo is PlayerView)
                {
                    ContextMenuStrip cont;
                    if (ContextMap.ContainsKey(vo.ID))
                    {
                        cont = ContextMap[vo.ID];
                    }
                    else
                    {
                        cont = new ContextMenuStrip();
                    }
                    ToolStripMenuItem tsmi = new ToolStripMenuItem(ga.Description);
                    tsmi.Click += (o, e) => { SelectedAction = ga; };
                    cont.Items.Add(tsmi);
                    if (vo.ID == MainPlayer)
                    {
                        grpPlayer1.ContextMenuStrip = cont;
                    }
                    else
                    {
                        grpPlayer2.ContextMenuStrip = cont;
                    }
                    ContextMap.Add(vo.ID, cont);
                }
                else if (vo is ManaPointView)
                {
                    ContextMenuStrip cont;
                    if (ContextMap.ContainsKey(vo.ID))
                    {
                        cont = ContextMap[vo.ID];
                    }
                    else
                    {
                        cont = new ContextMenuStrip();
                    }
                    ToolStripMenuItem tsmi = new ToolStripMenuItem(ga.Description);
                    tsmi.Click += (o, e) => { SelectedAction = ga; };
                    cont.Items.Add(tsmi);

                    if (!ContextMap.ContainsKey(vo.ID))
                    {
                        ContextMap.Add(vo.ID, cont);
                    }
                }
                else if (vo is CounterView)
                {
                    ContextMenuStrip cont;
                    if (ContextMap.ContainsKey(vo.ID))
                    {
                        cont = ContextMap[vo.ID];
                    }
                    else
                    {
                        cont = new ContextMenuStrip();
                    }
                    ToolStripMenuItem tsmi = new ToolStripMenuItem(ga.Description);
                    tsmi.Click += (o, e) => { SelectedAction = ga; };
                    cont.Items.Add(tsmi);

                    ContextMap.Add(vo.ID, cont);
                }
            }
        }
Exemplo n.º 32
0
 protected virtual void OnViewChanged(ViewObject viewObject)
 {
     ViewChanged?.Invoke(viewObject, EventArgs.Empty);
 }
Exemplo n.º 33
0
        private List<ViewObject> GetImageData()
        {
            List<ViewObject> ret = new List<ViewObject>();

            MemoryStream tipMS = null;

            bool injectTIP = false;

            PxeAccess.TIPStatus tipStatus;

            if (m_CaseObj.caseType == CaseType.FTICase)
            {
                DataAttachment ftiAttachment = null;
                foreach (DataAttachment attachment in m_CaseObj.attachments.GetFTIImageAttachments())
                {
                    tipMS = attachment.attachmentData;
                    injectTIP = true;
                    ftiAttachment = attachment;
                    break;
                }

                m_CaseObj.attachments.Remove(ftiAttachment);
            }

            foreach (DataAttachment attachment in m_CaseObj.attachments.GetXrayImageAttachments())
            {
                MemoryStream ms = attachment.attachmentData;

                PxeAccess pxeAccess = new PxeAccess();

                Rect view0Rect = new Rect();
                Rect view1Rect = new Rect();

                if (injectTIP)
                {
                    tipStatus = new PxeAccess.TIPStatus();
                    pxeAccess.OpenPXEImageFromMemoryWithTIP(ms, tipMS, ref tipStatus);

                    if (tipStatus.injectionsucess == 0)
                    {
                        m_CaseObj.IsCaseEditable = false;
                        m_SysConfig.SelectedArchiveDuringAutoSelect = true;                       
                    }
                    else
                    {
                        view0Rect = new Rect(new Point((double)tipStatus.injectLocation_view0.left,
                                                       (double)tipStatus.injectLocation_view0.top),
                                             new Point((double)tipStatus.injectLocation_view0.right,
                                                       (double)tipStatus.injectLocation_view0.bottom));

                        view1Rect = new Rect(new Point((double)tipStatus.injectLocation_view1.left,
                                                       (double)tipStatus.injectLocation_view1.top),
                                             new Point((double)tipStatus.injectLocation_view1.right,
                                                       (double)tipStatus.injectLocation_view1.bottom));
                    }
                }
                else
                {
                    pxeAccess.OpenPXEImageFromMemory(ms);
                }

                if (pxeAccess.pxeHeader.sequenceNum != null)
                {
                    if (m_CaseObj.scanInfo == null)
                    {
                        m_CaseObj.scanInfo = new ScanInfo();
                    }

                    if (m_CaseObj.scanInfo.container == null)
                    {
                        m_CaseObj.scanInfo.container = new Container();
                    }

                    m_CaseObj.scanInfo.container.SequenceNum = pxeAccess.pxeHeader.sequenceNum.ToString();
                }

                if (pxeAccess.pxeHeader.batchNumber != null)
                {
                    if (m_CaseObj.scanInfo == null)
                    {
                        m_CaseObj.scanInfo = new ScanInfo();
                    }

                    if (m_CaseObj.scanInfo.conveyance == null)
                    {
                        m_CaseObj.scanInfo.conveyance = new Conveyance();
                    }

                    m_CaseObj.scanInfo.conveyance.BatchNum = pxeAccess.pxeHeader.batchNumber.ToString();
                }

                if (pxeAccess.pxeHeader.viewBuffer_0.isValidView != 0)
                {
                    SourceObject highEnergy = null;
                    SourceObject lowEnergy = null;
                    SourceObject trimat = null;
                    ViewType viewType = ViewType.Unknown;

                    int width = (int)pxeAccess.pxeHeader.viewBuffer_0.width;
                    int height = (int)pxeAccess.pxeHeader.viewBuffer_0.height;

                    if (pxeAccess.pxeHeader.viewBuffer_0.isDualEnergy != 0)
                    {
                        highEnergy = new SourceObject(pxeAccess.GetImageBuffer("RawH"), width, height, m_SysConfig.FlipView1XAxis, m_SysConfig.FlipView1YAxis);
                        lowEnergy = new SourceObject(pxeAccess.GetImageBuffer("RawL"), width, height, m_SysConfig.FlipView1XAxis, m_SysConfig.FlipView1YAxis);
                        trimat = new SourceObject(pxeAccess.GetImageBuffer("FinalCompHL"), pxeAccess.GetImageBuffer("FinalAlpha"), width, height, m_SysConfig.FlipView1XAxis, m_SysConfig.FlipView1YAxis);
                        viewType = ViewType.DualEnergy;
                    }
                    else if (width > 0 && height > 0 && pxeAccess.pxeHeader.viewBuffer_0.isHighEnergy != 0)
                    {
                        highEnergy = new SourceObject(pxeAccess.GetImageBuffer("RawH"), width, height, m_SysConfig.FlipView1XAxis, m_SysConfig.FlipView1YAxis);
                        viewType = ViewType.HighEnergy;
                    }
                    else if (width > 0 && height > 0 && pxeAccess.pxeHeader.viewBuffer_0.isHighEnergy == 0)
                    {
                        lowEnergy = new SourceObject(pxeAccess.GetImageBuffer("RawL"), width, height, m_SysConfig.FlipView1XAxis, m_SysConfig.FlipView1YAxis);
                        viewType = ViewType.LowEnergy;
                    }

                    ViewObject viewObj = new ViewObject("View0",
                                                        pxeAccess.pxeHeader.pxeIndex,
                                                        viewType,
                                                        highEnergy,
                                                        lowEnergy,
                                                        trimat,
                                                        pxeAccess.pxeHeader.detectorsPerBoard,
                                                        pxeAccess.pxeHeader.bitsPerPixel,
                                                        pxeAccess.pxeHeader.samplingSpeed,
                                                        pxeAccess.pxeHeader.samplingSpace,
                                                        GetAnnotationsForView("View0"));

                    if (injectTIP)
                    {
                        viewObj.TIPMarkings = new List<Rect>();
                        viewObj.TIPMarkings.Add(view0Rect);
                    }

                    m_View0HighEnergySource = highEnergy;

                    ret.Add(viewObj);                    
                }

                if (pxeAccess.pxeHeader.viewBuffer_1.isValidView != 0)
                {
                    SourceObject highEnergy = null;
                    SourceObject lowEnergy = null;
                    SourceObject trimat = null;
                    ViewType viewType = ViewType.Unknown;

                    int width = (int)pxeAccess.pxeHeader.viewBuffer_1.width;
                    int height = (int)pxeAccess.pxeHeader.viewBuffer_1.height;

                    if (pxeAccess.pxeHeader.viewBuffer_0.isDualEnergy != 0)
                    {
                        highEnergy = new SourceObject(pxeAccess.GetImageBuffer("RawH1"), width, height, m_SysConfig.FlipView2XAxis, m_SysConfig.FlipView2YAxis);
                        lowEnergy = new SourceObject(pxeAccess.GetImageBuffer("RawL1"), width, height, m_SysConfig.FlipView2XAxis, m_SysConfig.FlipView2YAxis);
                        trimat = new SourceObject(pxeAccess.GetImageBuffer("FinalCompHL1"), pxeAccess.GetImageBuffer("FinalAlpha1"), width, height, m_SysConfig.FlipView2XAxis, m_SysConfig.FlipView2YAxis);
                        viewType = ViewType.DualEnergy;
                    }
                    else if (width > 0 && height > 0 && pxeAccess.pxeHeader.viewBuffer_0.isHighEnergy != 0)
                    {
                        highEnergy = new SourceObject(pxeAccess.GetImageBuffer("RawH1"), width, height, m_SysConfig.FlipView2XAxis, m_SysConfig.FlipView2YAxis);
                        viewType = ViewType.HighEnergy;
                    }
                    else if (width > 0 && height > 0 && pxeAccess.pxeHeader.viewBuffer_0.isHighEnergy == 0)
                    {
                        lowEnergy = new SourceObject(pxeAccess.GetImageBuffer("RawL1"), width, height, m_SysConfig.FlipView2XAxis, m_SysConfig.FlipView2YAxis);
                        viewType = ViewType.LowEnergy;
                    }

                    ViewObject viewObj = new ViewObject("View1",
                                                        pxeAccess.pxeHeader.pxeIndex,
                                                        viewType,
                                                        highEnergy,
                                                        lowEnergy,
                                                        trimat,
                                                        pxeAccess.pxeHeader.detectorsPerBoard,
                                                        pxeAccess.pxeHeader.bitsPerPixel,
                                                        pxeAccess.pxeHeader.samplingSpeed,
                                                        pxeAccess.pxeHeader.samplingSpace,
                                                        GetAnnotationsForView("View1"));

                    if (injectTIP)
                    {
                        viewObj.TIPMarkings = new List<Rect>();
                        viewObj.TIPMarkings.Add(view1Rect);
                    }

                    ret.Add(viewObj);                    
                }

                Conversion.SamplingSpace = pxeAccess.pxeHeader.samplingSpace;
            }

            return ret;
        }
Exemplo n.º 34
0
        private static void WriteViewObjectToXML(XmlWriter writer, ViewObject obj)
        {
            writer.WriteStartElement("ViewObject");

            //writer.WriteAttributeString("area", obj.m_Area.ToString());// Need?
            //writer.WriteAttributeString("star", obj.m_Layer.ToString());// Need?

            writer.WriteStartElement("Position");
            writer.WriteElementString("X", obj.Position.X.ToString(usa));
            writer.WriteElementString("Y", obj.Position.Y.ToString(usa));
            writer.WriteElementString("Z", obj.Position.Z.ToString(usa));
            writer.WriteEndElement();

            writer.WriteElementString("YRotation", obj.YRotation.ToString(usa));

            writer.WriteStartElement("Parameters");
            writer.WriteAttributeString("count", "3");
            for (int j = 0; j < 3; j++)
            {
                writer.WriteStartElement("Parameter");
                writer.WriteAttributeString("id", j.ToString());
                writer.WriteString(obj.Parameters[j].ToString());
                writer.WriteEndElement();
            }
            writer.WriteEndElement();

            writer.WriteEndElement();
        }
        private void MyCV_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            ViewObject selected = (ViewObject)e.SelectedItem;

            DisplayAlert("Xamarin CarouselView", selected.Uri, "OK");
        }
Exemplo n.º 36
0
        private void OnShowExecuted(ViewObject viewObject)
        {
            Uri viewNav = new Uri(viewObject.View, UriKind.Relative);
            RegionManager.RequestNavigate(RegionNames.WorkspaceRegion, viewNav);

            UpdateVisibilities(viewObject);
        }
Exemplo n.º 37
0
        private void ReadObjectTable(NitroOverlay ovl, uint offset, int area)
        {
            uint subtbl_num    = ovl.Read32(offset);
            uint subtbl_offset = ovl.ReadPointer(offset + 0x4);

            for (uint st = 0; st < subtbl_num; st++)
            {
                uint curoffset = subtbl_offset + (st * 8);

                byte flags          = ovl.Read8(curoffset);
                byte entries_num    = ovl.Read8(curoffset + 0x1);
                uint entries_offset = ovl.ReadPointer(curoffset + 0x4);

                byte type  = (byte)(flags & 0x1F);
                byte layer = (byte)(flags >> 5);

                if (type == 11)
                {
                    m_MinimapFileIDs = new ushort[entries_num];
                }

                for (byte e = 0; e < entries_num; ++e)
                {
                    LevelObject    obj;
                    INitroROMBlock objData = new INitroROMBlock();
                    objData.m_Data = ovl.ReadBlock((uint)(entries_offset + e * k_LevelObjTypeSizes[type]), (uint)k_LevelObjTypeSizes[type]);
                    switch (type)
                    {
                    case 0:
                        obj = new StandardObject(objData, m_LevelObjects.Count, layer, area);
                        break;

                    case 1:
                        obj = new EntranceObject(objData, m_LevelObjects.Count, layer, m_EntranceID++);
                        break;

                    case 2:     // Path Node
                        obj = new PathPointObject(objData, m_LevelObjects.Count, m_PathNodeID++);
                        break;

                    case 3:     // Path
                        obj = new PathObject(objData, m_LevelObjects.Count, (ushort)m_PathID++);
                        break;

                    case 4:
                        obj = new ViewObject(objData, m_LevelObjects.Count, m_ViewID++);
                        break;

                    case 5:
                        obj = new SimpleObject(objData, m_LevelObjects.Count, layer, area);
                        break;

                    case 6:
                        obj = new TpSrcObject(objData, m_LevelObjects.Count, layer);
                        break;

                    case 7:
                        obj = new TpDstObject(objData, m_LevelObjects.Count, layer);
                        break;

                    case 8:
                        // Fog
                        obj = new FogObject(objData, m_LevelObjects.Count, layer, area);
                        break;

                    case 9:
                        obj = new DoorObject(objData, m_LevelObjects.Count, layer);
                        break;

                    case 10:
                        obj = new ExitObject(objData, m_LevelObjects.Count, layer);
                        break;

                    case 11:
                        obj = new MinimapTileIDObject(objData, m_LevelObjects.Count, layer, m_MinimapTileIDNum++);
                        // This is still used by Minimap Editor
                        m_MinimapFileIDs[e] = ovl.Read16((uint)(entries_offset + (e * 2)));
                        break;

                    case 12:
                        // per-area minimap scale factors
                        obj = new MinimapScaleObject(objData, m_LevelObjects.Count, layer, area);
                        break;

                    case 14:
                        // ??? Unknown
                        obj = new Type14Object(objData, m_LevelObjects.Count, layer, area);
                        break;

                    default:
                        throw new InvalidDataException("Bad object type: " + type);
                    }

                    m_LevelObjects.Add(obj.m_UniqueID, obj);
                }
            }
        }
Exemplo n.º 38
0
 private void UpdateVisibilities(ViewObject obj)
 {
     UpdateVisibilities(obj?.View);
 }
Exemplo n.º 39
0
        public void Setup(ViewObject content, History history, SysConfiguration sysConfig)
        {
            if (!IsSetup)
            {
                m_ViewObject = content;

                m_History = history;
                m_History.CurrentHistoryChangedEvent += new CurrentHistoryChanged(ApplyHistory);

                if (m_ViewObject.HighEnergy != null)
                {
                    m_SourceObject = m_ViewObject.HighEnergy;
                    HEImage.Source = new BitmapImage(new Uri(@"/L3.Cargo.Workstation.Plugins.XRayImageBase;component/Resources/Icons/HEOn.png", UriKind.Relative));
                    LEImage.Source = new BitmapImage(new Uri(@"/L3.Cargo.Workstation.Plugins.XRayImageBase;component/Resources/Icons/LEOff.png", UriKind.Relative));
                }
                else if (m_ViewObject.LowEnergy != null)
                {
                    m_SourceObject = m_ViewObject.LowEnergy;
                    HEImage.Source = new BitmapImage(new Uri(@"/L3.Cargo.Workstation.Plugins.XRayImageBase;component/Resources/Icons/HEOff.png", UriKind.Relative));
                    LEImage.Source = new BitmapImage(new Uri(@"/L3.Cargo.Workstation.Plugins.XRayImageBase;component/Resources/Icons/LEOn.png", UriKind.Relative));
                }
                else
                {
                    throw new Exception();
                }

                if (m_ViewObject.LowEnergy == null ||
                    m_ViewObject.HighEnergy == null)
                {
                    XRayDualEnergy_ToolBar.Visibility = Visibility.Collapsed;
                }
                else
                {
                    HistoryDualEnergy dualEnergy = new HistoryDualEnergy();
                    dualEnergy.name = "HighEnergy";
                    m_History.SetFirstStep(dualEnergy);
                }

                if (sysConfig != null)
                {
                    m_sysConfig = sysConfig;
                    CreateUserMacroControls();
                    Macro_Toolbar.Visibility = Visibility.Visible;
                }

                CreateBufferControls();

                CreateFilterControls();

                CreateColorMappingControls();

                MainImage.Source = m_SourceObject.Source;
                MainImage.Height = m_SourceObject.Height;
                MainImage.Width  = m_SourceObject.Width;

                HistoryBuffer buffer = new HistoryBuffer();
                buffer.name = "Original Gray Scale";

                m_History.SetFirstStep(buffer);

                HistoryList.DataContext = m_History.Step;

                IsApplyHistoryFromSetup = true;

                m_History.ApplyStep();

                IsApplyHistoryFromSetup = false;

                IsSetup = true;
            }
        }