Esempio n. 1
0
 private void RenderTags2(IList<ImageTag> tags)
 {
     foreach (ImageTag tag in tags) {
         TagUtility tu = new TagUtility (tag);
         PaintTaggedBox (tu.FetchAsRectangleF(), tag.TagString);
     }
 }
Esempio n. 2
0
 private void RenderTags(IList<ImageTag> tags)
 {
     List<RectangleF> rects = new List<RectangleF> ();
     List<String> tagStrings = new List<string>();
     foreach(ImageTag tag in tags){
         Console.WriteLine("RenderTags():"+tag.ToString());
         TagUtility tu = new TagUtility (tag);
         rects.Add (tu.FetchAsRectangleF ());
         tagStrings.Add(tag.TagString);
     }
     PaintBoxes(rects);
     DrawTexts (tagStrings, rects);
 }
Esempio n. 3
0
        string[] ExtractTagImages(ImageTag tag)
        {
            GalleryObject go = AppDelegate.dao.GetGalleryObjectByID (tag.GalleryObjectID);

            var documentsDirectory = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
            var gallerydirectory = Path.Combine (documentsDirectory, "gallery");
            string imagefilename = go.imageFileName;
            string path = Path.Combine (gallerydirectory, imagefilename);
            UIImage MasterImage = UIImage.FromFile (path);

            CGImage cg = MasterImage.CGImage;
            TagUtility tu = new TagUtility (tag);
            CGImage neo = cg.WithImageInRect (tu.FetchAsRectangleF());

            UIImage cutout = UIImage.FromImage (neo);
            //UIImage thumbnail = cutout.Scale (new SizeF(50, 50));
            return SaveCutout (RandomGeneratedName (), cutout);
        }
Esempio n. 4
0
        void ShowDetails(ImageTag mytag)
        {
            this.tag = mytag;
            TagUtility tu = new TagUtility (tag);
            fetcher = tu.FetchAsRectangleF ();
            string tagText = MonoTouch.Foundation.NSBundle.MainBundle.LocalizedString ("Tag", "Tag");
            this.tagIdLabel.Text = tagText + ":"+mytag.ID;

            this.xTextField.Text = fetcher.X.ToString();
            this.yTextField.Text = fetcher.Y.ToString ();
            this.WidthLabel.Text = MonoTouch.Foundation.NSBundle.MainBundle.LocalizedString ("Width", "Width");
            this.Label_Height.Text = MonoTouch.Foundation.NSBundle.MainBundle.LocalizedString ("Height", "Height");
            this.TextField_height.Text = fetcher.Height.ToString ();
            this.WidthTextField.Text = fetcher.Width.ToString ();

            this.TextField_height.ValueChanged += (object sender, EventArgs e) => {
                try{
                    float height = float.Parse(this.TextField_height.Text.Replace(',', '.'), System.Globalization.CultureInfo.InvariantCulture);
                    fetcher.Height = height;
                    tu.StoreRectangleF(fetcher);
                    AppDelegate.dao.SaveTag(mytag);
                }catch(Exception ex){
                    Console.WriteLine("exception happend, defaulting value:"+ex.ToString());
                    this.Label_Height.Text = fetcher.Height.ToString();
                }
            };

            this.WidthTextField.ValueChanged += (object sender, EventArgs e) => {
                try{
                    float width = float.Parse(this.WidthTextField.Text.Replace(',', '.'), System.Globalization.CultureInfo.InvariantCulture);
                    fetcher.Width = width;
                    tu.StoreRectangleF(fetcher);
                    AppDelegate.dao.SaveTag(mytag);
                }catch(Exception ex){
                    Console.WriteLine("exception happend, defaulting value:"+ex.ToString());
                    this.WidthTextField.Text = fetcher.Width.ToString();
                }
            };

            this.xTextField.ValueChanged += (object sender, EventArgs e) => {
                try{
                    float x = float.Parse(this.xTextField.Text.Replace(',', '.'), System.Globalization.CultureInfo.InvariantCulture);
                    fetcher.X = x;
                    tu.StoreRectangleF(fetcher);
                    AppDelegate.dao.SaveTag(mytag);
                }catch(Exception ex){
                    Console.WriteLine("exception happend, defaulting value:"+ex.ToString());
                    this.xTextField.Text = fetcher.X.ToString();
                }
            };

            this.yTextField.ValueChanged += (object sender, EventArgs e) => {
                try{
                    float y = float.Parse(this.yTextField.Text.Replace(',', '.'), System.Globalization.CultureInfo.InvariantCulture);
                    fetcher.Y = y;
                    tu.StoreRectangleF(fetcher);
                    AppDelegate.dao.SaveTag(mytag);
                }catch(Exception ex){
                    Console.WriteLine("exception happend, defaulting value:"+ex.ToString());
                    this.yTextField.Text = fetcher.Y.ToString();
                }
            };

            this.xTextField.ShouldReturn += textField => {
                textField.ResignFirstResponder();
                return true;
            };
            this.yTextField.ShouldReturn += textField => {
                textField.ResignFirstResponder();
                return true;
            };

            this.TextField_height.ShouldReturn += textField => {
                textField.ResignFirstResponder();
                return true;
            };
            this.WidthTextField.ShouldReturn += textField => {
                textField.ResignFirstResponder();
                return true;
            };
        }
Esempio n. 5
0
        void EditTagFrame(UIGestureRecognizer gestureRecognizer)
        {
            Console.WriteLine ("edittagframe triggered");
            if (mylock == false) {
                Console.WriteLine ("mutex aquired");
                mylock = true;
                point = gestureRecognizer.LocationInView (this.blend);
            //			Console.WriteLine ("presspoint:" + point);
            //			PointF center = scrollView.Center;
            //			Console.WriteLine("center:"+scrollView.Center);
            //			float scale = scrollView.ZoomScale;
            //			PointF con = new PointF (scrollView.ContentOffset.X / scale, scrollView.ContentOffset.Y / scale);
            //			PointF con = new PointF (scrollView.ContentOffset.X, scrollView.ContentOffset.Y);
            //			Console.WriteLine ("con:" + con);
            //			PointF guess = new PointF (con.X + point.X, con.Y + point.Y);
            //			Console.WriteLine ("guess:" + guess);

                Rects = new List<RectangleF> ();
                Tags = AppDelegate.dao.GetTagsByGalleryObjectID (go.ID);
                for (int i = 0; i < Tags.Count; i++) {
                    TagUtility tu = new TagUtility (Tags [i]);
                    Rects.Add (tu.FetchAsRectangleF ());
                }
                for (int j = 0; j < Rects.Count; j++) {
                    if (Rects [j].Contains (point)) {
            //						if (finds.Exists (x => x.ID == Tags [j].ID)) {
            //							Console.WriteLine ("pushing:" + Tags [j]);
            //							finds.Remove (Tags [j]);
                        tds = new TagDetailScreen (Tags [j],this);

                        found = true;
            //						tds.backpush += (object sender, BackClickedEventArgs e) => {
            //							Console.WriteLine("mutex released");
            //							mylock = false;
            //						};
                        this.NavigationController.PushViewController(tds, true);
                        //this.NavigationController.PushViewController (tds, false);
                        break;
            //						} else {
            //							Console.WriteLine ("adder:" + Tags [j]);
            //							Console.WriteLine ("finds:" + finds.Count);
            //							finds.Add (Tags [j]);
            //							break;
            //						}
                    }
                }
                if (!found) {
                    Console.WriteLine ("releasing mutex");
                    mylock = false;
                }
            }
        }