public static List <ROSHotSpot> GetFromShopMallFloorHotspotData(ShopMallFloorHotspotData shopMallFloorData) { List <ROSHotSpot> spots = new List <ROSHotSpot>(); for (int i = 0; i < shopMallFloorData.ShopInfos.Count; i++) { if (shopMallFloorData.ShopInfos[i].HotSpotInfo != null) { ROSHotSpot rosHot = new ROSHotSpot(shopMallFloorData.ShopInfos[i].HotSpotInfo); spots.Add(rosHot); } } return(spots); }
public static ObservableCollection <HotSpotService.ROSHotSpot> HotSpotsToList(ObservableCollection <ShopHotSpot> hotSpots, double imageWidth, double imageHeight) { ObservableCollection <HotSpotService.ROSHotSpot> rosHotSpots = new ObservableCollection <HotSpotService.ROSHotSpot>(); foreach (ShopHotSpot shopHot in hotSpots) { ROSHotSpot rosHot = new ROSHotSpot(); rosHot.ShopNO = shopHot.DataID.ToString(); rosHot.HotSpotPoints = new List <Point>(shopHot.ShowPolygon.Points); rosHot.ImageWidth = imageWidth; rosHot.ImageHeight = imageHeight; rosHot.TextInfo = new HotSpotText(shopHot.ShowTextBlock); rosHot.ToolTip = shopHot.Comment; rosHotSpots.Add(rosHot.ToWebROSHotSpot()); } return(rosHotSpots); }
public static string HotSpotsToJson(ObservableCollection <ShopHotSpot> hotSpots, double imageWidth, double imageHeight) { List <ROSHotSpot> rosHotSpots = new List <ROSHotSpot>(); foreach (ShopHotSpot shopHot in hotSpots) { //shopHot.UpdateInfo(); ROSHotSpot rosHot = new ROSHotSpot(); rosHot.ShopNO = shopHot.DataID.ToString(); rosHot.HotSpotPoints = new List <Point>(shopHot.ShowPolygon.Points); rosHot.ImageWidth = imageWidth; rosHot.ImageHeight = imageHeight; rosHot.TextInfo = new HotSpotText(shopHot.ShowTextBlock); rosHot.ToolTip = shopHot.Comment; rosHotSpots.Add(rosHot); } return("{\"total\":" + rosHotSpots.Count.ToString() + ",\"rows\":" + JsonConvert.SerializeObject(rosHotSpots) + "}"); }
private void AddToCanvas(ROSHotSpot rosHotSpot, Mode mode) { ShopHotSpot shopHot = new ShopHotSpot(rosHotSpot, casDrawPanel, mode, this); HostSpots.Add(shopHot); }
public ShopHotSpot(ROSHotSpot rosHotSpot, Canvas canvas, Mode mode, MainPage mainPage) : base(Guid.NewGuid()) { this.DataID = rosHotSpot.ShopNO; this.Brand = rosHotSpot.GetBrandInfo().Name; this.Name = rosHotSpot.TextInfo.Text; this.IsRotate = rosHotSpot.TextInfo.TextIsVertical; ShopInfo shopInfo = ShopInfo.GetBySeatNo(this.DataID); if (shopInfo != null) { if (rosHotSpot.TextInfo != null) { rosHotSpot.TextInfo.Text = shopInfo.ShowText; } this.Comment = shopInfo.ShowTooltip; } showPolygon = new Polygon(); foreach (Point hotSpotPoint in rosHotSpot.HotSpotPoints) { showPolygon.Points.Add(hotSpotPoint); HostSpotArea.Add(hotSpotPoint); } showPolygon.Stroke = new SolidColorBrush(rosHotSpot.GetBrandInfo().BorderColor); showPolygon.StrokeThickness = 1; showPolygon.Fill = new SolidColorBrush(rosHotSpot.GetBrandInfo().FillColor); showPolygon.MouseEnter += new MouseEventHandler(polygon_OnMouseEnter); showPolygon.MouseLeave += new MouseEventHandler(polygon_OnMouseLeave); showTextBlock = new TextBlock(); showTextBlock.HorizontalAlignment = HorizontalAlignment.Center; showTextBlock.VerticalAlignment = VerticalAlignment.Center; showTextBlock.TextAlignment = TextAlignment.Left; showTextBlock.TextWrapping = TextWrapping.Wrap; //textBlock.Foreground = new SolidColorBrush(rosHotSpot.GetBrandInfo().FontColor); showTextBlock.FontFamily = new FontFamily("Arial"); showTextBlock.Foreground = new SolidColorBrush(ColorFromString.ToColor("#AAFCFA")); showTextBlock.Inlines.Add(rosHotSpot.TextInfo.Text); Canvas.SetLeft(showTextBlock, rosHotSpot.TextInfo.TextLeft); Canvas.SetTop(showTextBlock, rosHotSpot.TextInfo.TextTop); TransformGroup transformGroup = new TransformGroup(); ScaleTransform scaleTransform = new ScaleTransform(); scaleTransform.CenterX = rosHotSpot.TextInfo.TextScaleCenterX; scaleTransform.CenterY = rosHotSpot.TextInfo.TextScaleCenterY; scaleTransform.ScaleX = rosHotSpot.TextInfo.TextScaleX; scaleTransform.ScaleY = rosHotSpot.TextInfo.TextScaleY; transformGroup.Children.Add(scaleTransform); if (rosHotSpot.TextInfo.TextIsVertical) { RotateTransform rotateTransform = new RotateTransform(); rotateTransform.CenterX = rosHotSpot.TextInfo.TextVerticalCenterX; rotateTransform.CenterY = rosHotSpot.TextInfo.TextVerticalCenterY; rotateTransform.Angle = rosHotSpot.TextInfo.TextVerticalAngle; transformGroup.Children.Add(rotateTransform); } showTextBlock.RenderTransform = transformGroup; showTextBlock.MouseEnter += new MouseEventHandler(textBlock_OnMouseEnter); showPolygon.Tag = this; showTextBlock.Tag = this; AddContextMenu(showTextBlock, mode, mainPage); AddContextMenu(showPolygon, mode, mainPage); ToolTipService.SetToolTip(showPolygon, this.Comment); ToolTipService.SetToolTip(ShowTextBlock, this.Comment); canvas.Children.Add(showPolygon); canvas.Children.Add(showTextBlock); }