Esempio n. 1
0
        public Point GetShadowHotspot(HotspotType hotspotType)
        {
            Point point = new Point(0, 0);

            switch (hotspotType)
            {
            case HotspotType.Left:
                point.X = (double)Canvas.GetLeft(Shadow);
                point.Y = (double)Canvas.GetTop(Shadow) + Shadow.Height / 2;
                break;

            case HotspotType.Top:
                point.X = (double)Canvas.GetLeft(Shadow) + Shadow.Width / 2;
                point.Y = (double)Canvas.GetTop(Shadow);
                break;

            case HotspotType.Right:
                point.X = (double)Canvas.GetLeft(Shadow) + Shadow.Width;
                point.Y = (double)Canvas.GetTop(Shadow) + Shadow.Height / 2;
                break;

            case HotspotType.Bottom:
                point.X = (double)Canvas.GetLeft(Shadow) + Shadow.Width / 2;
                point.Y = (double)Canvas.GetTop(Shadow) + Shadow.Height;
                break;
            }
            return(point);
        }
Esempio n. 2
0
        public Point GetHotspot(HotspotType hotspotType)
        {
            Point point = new Point(0, 0);

            switch (hotspotType)
            {
            case HotspotType.Left:
                point.X = ShapeLine.plShadow.Points[0].X;
                point.Y = ShapeLine.plShadow.Points[0].Y;
                break;

            case HotspotType.Top:
                point.X = ShapeLine.plShadow.Points[0].X;
                point.Y = ShapeLine.plShadow.Points[0].Y;
                break;

            case HotspotType.Right:
                point.X = ShapeLine.plShadow.Points[1].X;
                point.Y = ShapeLine.plShadow.Points[1].Y;
                break;

            case HotspotType.Bottom:
                point.X = ShapeLine.plShadow.Points[1].X;
                point.Y = ShapeLine.plShadow.Points[1].Y;
                break;
            }
            return(point);
        }
Esempio n. 3
0
        public Point GetHotspot(HotspotType hotspotType)
        {
            Point point = new Point(0, 0);

            switch (hotspotType)
            {
            case HotspotType.Left:
                point.X = (double)Canvas.GetLeft(ShapeBegin) + ShapeBegin.HotspotLeft.Width / 2;
                point.Y = (double)Canvas.GetTop(ShapeBegin) + ShapeBegin.Height / 2;
                break;

            case HotspotType.Top:
                point.X = (double)Canvas.GetLeft(ShapeBegin) + ShapeBegin.Width / 2;
                point.Y = (double)Canvas.GetTop(ShapeBegin) + ShapeBegin.HotspotLeft.Height / 2;
                break;

            case HotspotType.Right:
                point.X = (double)Canvas.GetLeft(ShapeBegin) + ShapeBegin.Width - ShapeBegin.HotspotLeft.Width / 2;
                point.Y = (double)Canvas.GetTop(ShapeBegin) + ShapeBegin.Height / 2;
                break;

            case HotspotType.Bottom:
                point.X = (double)Canvas.GetLeft(ShapeBegin) + ShapeBegin.Width / 2;
                point.Y = (double)Canvas.GetTop(ShapeBegin) + ShapeBegin.Height - ShapeBegin.HotspotLeft.Height / 2;
                break;
            }
            return(point);
        }
Esempio n. 4
0
 public InfrastructureInfo QueryHotSpot(string name, HotspotType type)
 {
     return
         (_repository.FirstOrDefault(
              x =>
              x.InfrastructureType == InfrastructureType.HotSpot && x.HotspotName == name &&
              x.HotspotType == type));
 }
Esempio n. 5
0
        public async Task InsertHotSpotCell(string hotSpotName, HotspotType hotspotType, int id)
        {
            var infrastructure = FirstOrDefault(x =>
                                                x.HotspotName == hotSpotName && x.HotspotType == hotspotType &&
                                                x.InfrastructureType == InfrastructureType.Cell && x.InfrastructureId == id);

            if (infrastructure == null)
            {
                await InsertAsync(new InfrastructureInfo
                {
                    HotspotName        = hotSpotName,
                    HotspotType        = hotspotType,
                    InfrastructureType = InfrastructureType.Cell,
                    InfrastructureId   = id
                });
            }
        }
Esempio n. 6
0
        private void EndScene_AddWaypoint(HotspotType parType)
        {
            var justPosEncrypted = "justPos".GenLuaVarName();
            var posInfoEncrypted = Strings.GT_PosInfos.GenLuaVarName();
            var tmpVec           = ObjectManager.Player.Position;

            Functions.DoString(Strings.PosInfos.Replace("justPos", justPosEncrypted).Replace(Strings.GT_PosInfos, posInfoEncrypted));
            var pos = Functions.GetText(justPosEncrypted);

            Enums.PositionType posType;

            Main.MainForm.Invoke(new MethodInvoker(delegate
            {
                posType = Main.MainForm.rbHotspot.Checked ? Enums.PositionType.Hotspot : Enums.PositionType.Waypoint;

                switch (parType)
                {
                case HotspotType.Hotspot:
                    posType = Enums.PositionType.Hotspot;
                    listHotspots.Add(Tuple.Create(tmpVec, pos, posType));
                    Main.MainForm.tbHotspots.Text   += tmpVec + Environment.NewLine;
                    Main.MainForm.lHotspotCount.Text = "Count: " + listHotspots.Count;
                    boolAddWaypoint = false;
                    if (listHotspots.Count == 1)
                    {
                        profileStart = Functions.GetText(posInfoEncrypted);
                        Main.MainForm.lRecording.Text = "Recording" + Environment.NewLine + pos;
                    }
                    break;

                case HotspotType.VendorHotspot:
                    listVendorHotspots.Add(Tuple.Create(tmpVec, pos, posType));
                    Main.MainForm.tbVendorHotspots.Text   += tmpVec + Environment.NewLine;
                    Main.MainForm.lVendorHotspotCount.Text = "Count: " + listVendorHotspots.Count;
                    boolAddVendorWaypoint = false;
                    break;

                case HotspotType.Ghost:
                    listGhostHotspots.Add(Tuple.Create(tmpVec, pos, posType));
                    Main.MainForm.tbGhostHotspots.Text   += tmpVec + Environment.NewLine;
                    Main.MainForm.lGhostHotspotCount.Text = "Count: " + listGhostHotspots.Count;
                    boolAddGhostWaypoint = false;
                    break;
                }
            }));
        }
Esempio n. 7
0
        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            JObject     jo          = JObject.Load(reader);
            HotspotType hotspotType = (HotspotType)Enum.Parse(typeof(HotspotType), "" + jo["hotspotType"]);

            switch (hotspotType)
            {
            case HotspotType.Region:
                return(jo.ToObject <RegionHotspotDataModel>(serializer));

            case HotspotType.Image:
                return(jo.ToObject <ImageHotspotDataModel>(serializer));

            case HotspotType.Text:
                return(jo.ToObject <TextHotspotDataModel>(serializer));

            default:
                return(jo.ToObject <HotspotDataModel>(serializer));
            }
        }
Esempio n. 8
0
        public HotspotType GetNearHotspot(Point point)
        {
            PointCollection points = new PointCollection();

            points.Add(this.GetHotspot(HotspotType.Left));
            points.Add(this.GetHotspot(HotspotType.Top));
            points.Add(this.GetHotspot(HotspotType.Right));
            points.Add(this.GetHotspot(HotspotType.Bottom));

            HotspotType hotspotType = HotspotType.Left;
            int         idx         = 0;
            double      minValue    = Math.Abs(point.X - points[0].X) + Math.Abs(point.Y - points[0].Y);

            for (int i = 1; i < points.Count; i++)
            {
                if (minValue > (Math.Abs(point.X - points[i].X) + Math.Abs(point.Y - points[i].Y)))
                {
                    idx      = i;
                    minValue = Math.Abs(point.X - points[i].X) + Math.Abs(point.Y - points[i].Y);
                }
            }
            switch (idx)
            {
            case 0:
                hotspotType = HotspotType.Left;
                break;

            case 1:
                hotspotType = HotspotType.Top;
                break;

            case 2:
                hotspotType = HotspotType.Right;
                break;

            case 3:
                hotspotType = HotspotType.Bottom;
                break;
            }
            return(hotspotType);
        }
Esempio n. 9
0
        public HotspotType GetNearHotspot(Point point)
        {
            HotspotType hotspotType = HotspotType.Left;

            return(hotspotType);
        }
Esempio n. 10
0
 public Point GetShadowHotspot(HotspotType hotspotType)
 {
     return(GetHotspot(hotspotType));
 }
Esempio n. 11
0
        private void Line_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (trackingPointMouseMove)
            {
                FrameworkElement element = e.OriginalSource as FrameworkElement;
                SetImageSourcce(element, false);
                if (element != null)
                {
                    this.Fill(Colors.Green, 1);
                    element.Cursor = Cursors.Arrow;
                    element.ReleaseMouseCapture();
                }

                if (pointHadActualMove == true)
                {
                    plShadow.Points = GetPloyline(plShadow.Points, mousePosition, e.GetPosition(this._cnsParent));
                    PointCollection points = new PointCollection();
                    for (int i = 0; i < plShadow.Points.Count; i++)
                    {
                        points.Add(new Point(plShadow.Points[i].X + this._ShadowX + this._startLocation.X + this._container.SimpleShapeLeft,
                                             plShadow.Points[i].Y + this._ShadowY + this._startLocation.Y));

                    }

                    if (this.BeginElement != null || this.EndElement != null)
                    {
                        Point pBegin, pEnd;
                        PointCollection points2 = new PointCollection();
                        if (this.BeginElement != null)
                        {
                            this.BeginElementHotspot = ((IControlBase)this.BeginElement).GetNearHotspot(points[0]);
                            pBegin = ((IControlBase)this.BeginElement).GetHotspot(this.BeginElementHotspot);
                            ((IControlBase)this.BeginElement).SetUnFocus();
                            this.BeginElement = null;
                        }
                        else pBegin = points[0];
                        if (this.EndElement != null)
                        {
                            this.EndElementHotspot = ((IControlBase)this.EndElement).GetNearHotspot(points[1]);
                            pEnd = ((IControlBase)this.EndElement).GetHotspot(this.EndElementHotspot);
                            ((IControlBase)this.EndElement).SetUnFocus();
                            this.EndElement = null;
                        }
                        else pEnd = points[1];

                        points2.Add(pBegin);
                        points2.Add(points[1]);
                        points2.Add(pEnd);
                        points.Clear();
                        for (int i = 0; i < points2.Count; i++) points.Add(points2[i]);
                    }
                    this._container.CreateElement(this.Type, points);

                    e.Handled = true;
                    pointHadActualMove = false;
                }

                if (mousePosition != originalPosition)
                {
                    PointCollection points = this.GetMe();
                    this.ShowShadow(points);
                }
                trackingPointMouseMove = false;
            }
            plShadow.Visibility = Visibility.Collapsed;
        }
Esempio n. 12
0
        private void Line_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (trackingPointMouseMove)
            {
                FrameworkElement element = e.OriginalSource as FrameworkElement;
                SetImageSourcce(element, false);
                if (element != null)
                {
                    this.Fill(Colors.Green, 1);
                    element.Cursor = Cursors.Arrow;
                    element.ReleaseMouseCapture();
                }

                if (pointHadActualMove == true)
                {
                    plShadow.Points = GetPloyline(plShadow.Points, mousePosition, e.GetPosition(this._cnsParent));
                    PointCollection points = new PointCollection();
                    for (int i = 0; i < plShadow.Points.Count; i++)
                    {
                        points.Add(new Point(plShadow.Points[i].X + this._ShadowX + this._startLocation.X + this._container.SimpleShapeLeft,
                                             plShadow.Points[i].Y + this._ShadowY + this._startLocation.Y));
                    }

                    if (this.BeginElement != null || this.EndElement != null)
                    {
                        Point           pBegin, pEnd;
                        PointCollection points2 = new PointCollection();
                        if (this.BeginElement != null)
                        {
                            this.BeginElementHotspot = ((IControlBase)this.BeginElement).GetNearHotspot(points[0]);
                            pBegin = ((IControlBase)this.BeginElement).GetHotspot(this.BeginElementHotspot);
                            ((IControlBase)this.BeginElement).SetUnFocus();
                            this.BeginElement = null;
                        }
                        else
                        {
                            pBegin = points[0];
                        }
                        if (this.EndElement != null)
                        {
                            this.EndElementHotspot = ((IControlBase)this.EndElement).GetNearHotspot(points[1]);
                            pEnd = ((IControlBase)this.EndElement).GetHotspot(this.EndElementHotspot);
                            ((IControlBase)this.EndElement).SetUnFocus();
                            this.EndElement = null;
                        }
                        else
                        {
                            pEnd = points[1];
                        }

                        points2.Add(pBegin);
                        points2.Add(points[1]);
                        points2.Add(pEnd);
                        points.Clear();
                        for (int i = 0; i < points2.Count; i++)
                        {
                            points.Add(points2[i]);
                        }
                    }
                    this._container.CreateElement(this.Type, points);

                    e.Handled          = true;
                    pointHadActualMove = false;
                }

                if (mousePosition != originalPosition)
                {
                    PointCollection points = this.GetMe();
                    this.ShowShadow(points);
                }
                trackingPointMouseMove = false;
            }
            plShadow.Visibility = Visibility.Collapsed;
        }
Esempio n. 13
0
 public Point GetShadowHotspot(HotspotType hotspotType)
 {
     return GetHotspot(hotspotType);
 }
Esempio n. 14
0
 public Point GetHotspot(HotspotType hotspotType)
 {
     Point point = new Point(0, 0);
     switch (hotspotType)
     {
         case HotspotType.Left:
             point.X = ShapeLine.plShadow.Points[0].X;
             point.Y = ShapeLine.plShadow.Points[0].Y;
             break;
         case HotspotType.Top:
             point.X = ShapeLine.plShadow.Points[0].X;
             point.Y = ShapeLine.plShadow.Points[0].Y;
             break;
         case HotspotType.Right:
             point.X = ShapeLine.plShadow.Points[1].X;
             point.Y = ShapeLine.plShadow.Points[1].Y;
             break;
         case HotspotType.Bottom:
             point.X = ShapeLine.plShadow.Points[1].X;
             point.Y = ShapeLine.plShadow.Points[1].Y;
             break;
     }
     return point;
 }
Esempio n. 15
0
 public Point GetHotspot(HotspotType hotspotType)
 {
     Point point = new Point(0, 0);
     switch (hotspotType)
     {
         case HotspotType.Left:
             point.X = (double)Canvas.GetLeft(ShapeFinish) + ShapeFinish.HotspotLeft.Width / 2;
             point.Y = (double)Canvas.GetTop(ShapeFinish) + ShapeFinish.Height / 2;
             break;
         case HotspotType.Top:
             point.X = (double)Canvas.GetLeft(ShapeFinish) + ShapeFinish.Width / 2;
             point.Y = (double)Canvas.GetTop(ShapeFinish) + ShapeFinish.HotspotLeft.Height / 2;
             break;
         case HotspotType.Right:
             point.X = (double)Canvas.GetLeft(ShapeFinish) + ShapeFinish.Width - ShapeFinish.HotspotLeft.Width / 2;
             point.Y = (double)Canvas.GetTop(ShapeFinish) + ShapeFinish.Height / 2;
             break;
         case HotspotType.Bottom:
             point.X = (double)Canvas.GetLeft(ShapeFinish) + ShapeFinish.Width / 2;
             point.Y = (double)Canvas.GetTop(ShapeFinish) + ShapeFinish.Height - ShapeFinish.HotspotLeft.Height / 2;
             break;
     }
     return point;
 }
Esempio n. 16
0
 public Point GetShadowHotspot(HotspotType hotspotType)
 {
     Point point = new Point(0, 0);
     switch (hotspotType)
     {
         case HotspotType.Left:
             point.X = (double)Canvas.GetLeft(Shadow);
             point.Y = (double)Canvas.GetTop(Shadow) + Shadow.Height / 2;
             break;
         case HotspotType.Top:
             point.X = (double)Canvas.GetLeft(Shadow) + Shadow.Width / 2;
             point.Y = (double)Canvas.GetTop(Shadow);
             break;
         case HotspotType.Right:
             point.X = (double)Canvas.GetLeft(Shadow) + Shadow.Width;
             point.Y = (double)Canvas.GetTop(Shadow) + Shadow.Height / 2;
             break;
         case HotspotType.Bottom:
             point.X = (double)Canvas.GetLeft(Shadow) + Shadow.Width / 2;
             point.Y = (double)Canvas.GetTop(Shadow) + Shadow.Height;
             break;
     }
     return point;
 }
Esempio n. 17
0
 public IEnumerable <int> GetHotSpotInfrastructureIds(string name, InfrastructureType type, HotspotType hotspotType)
 {
     return(GetAll().Where(x =>
                           x.HotspotName == name && x.InfrastructureType == type && x.HotspotType == hotspotType
                           ).Select(x => x.InfrastructureId).ToList());
 }