//====================================================================== // TagVisualizer Functions //====================================================================== // When tag is detected private void UrbanTagVisualizer_VisualizationAdded(object sender, TagVisualizerEventArgs e) { if (canPlaceRoad) { return; } tagDetected = true; TagVisualization1 objectTag = (TagVisualization1)e.TagVisualization; switch (objectTag.VisualizedTag.Value) { case 0: objectTag.HouseModel.Content = "HOUSE ADDED"; objectTag.myHouse.Fill = SurfaceColors.Accent1Brush; break; case 1: objectTag.HouseModel.Content = "BUILDING ADDED"; objectTag.myHouse.Fill = SurfaceColors.Accent1Brush; break; case 2: objectTag.HouseModel.Content = "SKYSCRAPER ADDED"; objectTag.myHouse.Fill = SurfaceColors.Accent1Brush; break; default: objectTag.HouseModel.Content = "UNKNOWN MODEL"; objectTag.myHouse.Fill = SurfaceColors.Accent1Brush; break; } }
// When tag is removed, make scatterviewitem from last location private void UrbanTagVisualizer_VisualizationRemoved(object sender, TagVisualizerEventArgs e) { if (canPlaceRoad) { return; } tagDetected = false; TagVisualization1 objectTag = (TagVisualization1)e.TagVisualization; switch (objectTag.VisualizedTag.Value) { // house case 0: Point p = objectTag.Center; ScatterViewItem item = SetSVHouseImage("HouseEMI"); item.Center = p; item.Orientation = objectTag.Orientation; MainScatterview.Items.Add(item); history.Push(item); userPlacedHouses.Add(item); break; // building case 1: p = objectTag.Center; item = SetSVHouseImage("BuildingEMI"); item.Center = p; item.Orientation = objectTag.Orientation;; MainScatterview.Items.Add(item); history.Push(item); userPlacedHouses.Add(item); break; // skyscraper case 2: p = objectTag.Center; item = SetSVHouseImage("SkyscraperEMI"); item.Center = p; item.Orientation = objectTag.Orientation;; MainScatterview.Items.Add(item); history.Push(item); userPlacedHouses.Add(item); break; default: break; } }