/// <summary>
        /// Adds a log message about mouse event.
        /// </summary>
        /// <param name="annotationView">The annotation view.</param>
        /// <param name="eventName">The event name.</param>
        /// <param name="e">The <see cref="ObjectPropertyChangedEventArgs"/> instance containing the event data.</param>
        private void AddMouseEventLogMessage(
            AnnotationView annotationView,
            string eventName,
            MouseEventArgs e)
        {
            // location in viewer space
            PointF locationInViewerSpace = e.Location;

            // transformation from annotation space (DIP) to the viewer space
            PointFTransform toViewerTransform = annotationView.GetPointTransform(AnnotationViewer, AnnotationViewer.Image);
            PointFTransform inverseTransform  = toViewerTransform.GetInverseTransform();

            // location in annotation space (DIP)
            PointF locationInAnnotationSpace = inverseTransform.TransformPoint(locationInViewerSpace);

            // location in annotation content space
            PointF locationInAnnotationContentSpace;

            // matrix from annotation content space to the annotation space (DIP)
            using (Matrix fromDipToContentSpace = GdiConverter.Convert(annotationView.GetTransformFromContentToImageSpace()))
            {
                // DIP space -> annotation content space
                fromDipToContentSpace.Invert();
                PointF[] points = new PointF[] { locationInAnnotationSpace };
                fromDipToContentSpace.TransformPoints(points);
                locationInAnnotationContentSpace = points[0];
            }

            AddLogMessage(string.Format("{0}.{1}: ViewerSpace={2}; ContentSpace={3}",
                                        GetAnnotationInfo(annotationView),
                                        eventName,
                                        locationInViewerSpace,
                                        locationInAnnotationContentSpace));
        }
        void SetSideBarViewShowByMode()
        {
            isSideBarShow = true;
            nfloat width = sidebarViewWidth;

            if (ContentButton.State == NSCellStateValue.On)
            {
                nfloat height = TocCustomView.Frame.Height;
                StartViewAnotation(TocCustomView);

                IndexCustomView.SetFrameSize(new CGSize(0, height));
                AnnotationView.SetFrameSize(new CGSize(0, height));
            }
            else if (IndexButton.State == NSCellStateValue.On)
            {
                nfloat height = IndexCustomView.Frame.Height;
                StartViewAnotation(IndexCustomView);

                TocCustomView.SetFrameSize(new CGSize(0, height));
                AnnotationView.SetFrameSize(new CGSize(0, height));
            }
            else if (AnnotationButton.State == NSCellStateValue.On)
            {
                nfloat height = AnnotationView.Frame.Height;
                StartViewAnotation(AnnotationView);

                TocCustomView.SetFrameSize(new CGSize(0, height));
                IndexCustomView.SetFrameSize(new CGSize(0, height));
            }

            RelayoutContentPageView(false);
        }
Esempio n. 3
0
        /// <summary>
        /// Mouse is double clicked in viewer.
        /// </summary>
        private void AnnotationTool_MouseDoubleClick(object sender, Vintasoft.Imaging.UI.VisualTools.VisualToolMouseEventArgs e)
        {
            if (CommentTool != null && e.Button == AnnotationTool.ActionButton)
            {
                // find annnotation view
                AnnotationView view = AnnotationTool.FindAnnotationView(e.X, e.Y);

                // if annotation contains the annotation
                if (view != null && view.Data.Comment != null)
                {
                    // get annotation comment
                    Comment comment = view.Data.Comment;
                    // find comment control
                    ICommentControl commentControl = CommentTool.FindCommentControl(comment);

                    // if comment control is found
                    if (commentControl != null)
                    {
                        if (CommentTool.SelectedComment != commentControl)
                        {
                            CommentTool.SelectedComment = commentControl;
                        }

                        // open comment
                        comment.IsOpen = true;
                    }
                }
            }
        }
Esempio n. 4
0
        public FeatureLayerViewModel CreateFeatureLayerViewModel(Style style, AssetManager assetManager,
                                                                 AnnotationView annotationView, FeatureLayerContext layerContext)
        {
            var overlay = CreateVectorOverlay(style, assetManager, annotationView);

            return(new FeatureLayerViewModel(layerContext.Name, layerContext.Alias, overlay, layerContext.GeoDataManager));
        }
Esempio n. 5
0
        private void SetupMap(MapView map, Point center, int zoomLevel)
        {
            map.Controller.SetZoom(zoomLevel);
            map.Controller.SetCenter(new GeoPoint(center.Y, center.X));
            map.SetBuiltInZoomControls(true);

            _annotationView = new AnnotationView(map);
        }
        /// <summary>
        /// Adds the comment to the specified annotation view.
        /// </summary>
        /// <param name="view">The annotation view.</param>
        /// <returns>
        /// The comment.
        /// </returns>
        public AnnotationComment AddCommentToAnnotation(AnnotationView view)
        {
            if (view == null)
            {
                return(null);
            }

            return(AddCommentToAnnotation(view.Data));
        }
        public void Index_GivenAnnotationObject_ReturnIndexableFields()
        {
            var view = new AnnotationView(McmRepository.Object);
            var obj = Make_Annotation_Object();
            McmRepository.Setup(m => m.ObjectGet(new Guid("fe5c76fa-6f74-4604-a2de-ab2bd03a3cba"), true, true, true, true, true)).Returns(Make_UserObject());

            var annotationView = (AnnotationViewData)view.Index(obj).First();

            var indexableFields = annotationView.GetIndexableFields();
        }
 /// <summary>
 /// Unsubscribes from <see cref="AnnotationView"/> events.
 /// </summary>
 /// <param name="annotationView">The annotation view.</param>
 private void UnsubscribeFromAnnotationViewEvents(AnnotationView annotationView)
 {
     annotationView.Click       -= new MouseEventHandler(annotationView_Click);
     annotationView.DoubleClick -= new MouseEventHandler(annotationView_DoubleClick);
     annotationView.MouseDown   -= new MouseEventHandler(annotationView_MouseDown);
     annotationView.MouseEnter  -= new MouseEventHandler(annotationView_MouseEnter);
     annotationView.MouseLeave  -= new MouseEventHandler(annotationView_MouseLeave);
     annotationView.MouseMove   -= new MouseEventHandler(annotationView_MouseMove);
     annotationView.MouseUp     -= new MouseEventHandler(annotationView_MouseUp);
     annotationView.MouseWheel  -= new MouseEventHandler(annotationView_MouseWheel);
 }
 /// <summary>
 /// Subscribes to <see cref="AnnotationView"/> events.
 /// </summary>
 /// <param name="annotationView">The annotation view.</param>
 private void SubscribeToAnnotationViewEvents(AnnotationView annotationView)
 {
     annotationView.Click       += new MouseEventHandler(annotationView_Click);
     annotationView.DoubleClick += new MouseEventHandler(annotationView_DoubleClick);
     annotationView.MouseDown   += new MouseEventHandler(annotationView_MouseDown);
     annotationView.MouseEnter  += new MouseEventHandler(annotationView_MouseEnter);
     annotationView.MouseLeave  += new MouseEventHandler(annotationView_MouseLeave);
     annotationView.MouseMove   += new MouseEventHandler(annotationView_MouseMove);
     annotationView.MouseUp     += new MouseEventHandler(annotationView_MouseUp);
     annotationView.MouseWheel  += new MouseEventHandler(annotationView_MouseWheel);
 }
        public void Index_GivenAnnotationObject_ReturnViewDataWithPropertiesSet()
        {
            var view = new AnnotationView(McmRepository.Object);
            var obj = Make_Annotation_Object();
            McmRepository.Setup(m => m.ObjectGet(new Guid("fe5c76fa-6f74-4604-a2de-ab2bd03a3cba"), true, true, true, true, true)).Returns(Make_UserObject());

            var result = (AnnotationViewData)view.Index(obj).First();

            Assert.AreEqual(result.Identifier, "63a0348b-ab4b-8847-9c71-2d0b4771b0fe");
            Assert.AreEqual(result.StartTime, "00:55:27.0270000");
            Assert.AreEqual(result.Title, "Kashmir");
        }
Esempio n. 11
0
 /// <summary>
 /// Selects the comment of specified annotation view.
 /// </summary>
 /// <param name="view">The view.</param>
 private void SelectComment(AnnotationView view)
 {
     if (view == null)
     {
         CommentTool.SelectedComment = null;
     }
     else
     {
         if (view.Data.Comment != null)
         {
             CommentTool.SelectedComment = CommentTool.FindCommentControl(view.Data.Comment);
         }
     }
 }
Esempio n. 12
0
        /// <summary>
        /// Returns the name of the annotation.
        /// </summary>
        /// <param name="annotationView">The view of annotation.</param>
        /// <returns>
        /// The name of the annotation.
        /// </returns>
        protected override string GetAnnotationName(AnnotationView annotationView)
        {
            string annotationName = annotationView.ToString();

            if (annotationName.Length > 14 &&
                annotationName.EndsWith("AnnotationView", StringComparison.InvariantCulture))
            {
                annotationName = annotationName.Substring(0, annotationName.Length - 14);
            }
            if (annotationName.Length > 15 &&
                annotationName.StartsWith("AnnotationDemo.", StringComparison.InvariantCulture))
            {
                annotationName = annotationName.Substring(15, annotationName.Length - 15);
            }
            return(annotationName);
        }
        /// <summary>
        /// Returns a string with information about annotation view.
        /// </summary>
        /// <param name="annotationView">The annotation view.</param>
        /// <returns>
        /// A string with information about annotation view.
        /// </returns>
        private string GetAnnotationInfo(AnnotationView annotationView)
        {
            if (annotationView == null)
            {
                return("(none)");
            }
            string type = annotationView.GetType().FullName;

            type = type.Replace("Vintasoft.Imaging.Annotation.UI.", "");
            int index = -1;

            if (AnnotationViewer.AnnotationViewCollection != null)
            {
                index = AnnotationViewer.AnnotationViewCollection.IndexOf(annotationView);
            }
            return(string.Format("[{0}]{1}", index, type));
        }
Esempio n. 14
0
        public MyLocationLayerViewModel CreateMyLocationOverlay(string name, string alias,
                                                                PointStyleInfo userSymbol,
                                                                PointStyleInfo compassSymbol,
                                                                AssetManager assetManager,
                                                                IUserLocationTracker userLocationDataManager,
                                                                MapView mapVIew,
                                                                AnnotationView annotationView = null)
        {
            var      userDrawable    = CreateDrawable(userSymbol, assetManager);
            Drawable compassDrawable = null;

            if (compassSymbol != null)
            {
                compassDrawable = CreateDrawable(compassSymbol, assetManager);
            }
            var layer = new MyLocationOverlay(userDrawable, compassDrawable);

            layer.SetTapListener(new TapOverlayListener(layer, annotationView));
            return(new MyLocationLayerViewModel(name, alias, layer, userLocationDataManager, mapVIew));
        }
Esempio n. 15
0
        public ILayerViewModel CreateOverlay(FeatureLayerContext layerContext,
                                             MapView mapView,
                                             AssetManager assetManager,
                                             AnnotationView annotationView = null)
        {
            if (layerContext.StyleType == StyleType.Point)
            {
                var overlay = CreatePointOverlay((PointStyleInfo)layerContext.StyleInfo, assetManager, annotationView);
                return(new PointFeatureLayerViewModel(layerContext.Name, layerContext.Alias, overlay, layerContext.GeoDataManager));
            }

            //if (layerContext.StyleType == StyleType.Point)
            //{
            //    var style = MapquestStyleFactory.CreatePointStyle((PointStyleInfo)layerContext.StyleInfo, assetManager);
            //    return CreateFeatureLayerViewModel(style, assetManager, annotationView, layerContext);
            //}

            //if (layerContext.StyleType == StyleType.Line)
            //{
            //    var lineOverlay = CreateLineOverlay((LineStyleInfo) layerContext.StyleInfo);
            //    return new LineFeatureLayerViewModel(layerContext.Name, layerContext.Alias, lineOverlay, layerContext.GeoDataManager);
            //}

            if (layerContext.StyleType == StyleType.Line)
            {
                var lineStyle = MapquestStyleFactory.CreateLineStyle((LineStyleInfo)layerContext.StyleInfo);
                return(CreateFeatureLayerViewModel(lineStyle, assetManager, annotationView, layerContext));
            }

            if (layerContext.StyleType == StyleType.Polygon)
            {
                var overlay = CreatePolygonOverlay((PolygonStyleInfo)layerContext.StyleInfo);
                return(new PolygonFeatureLayerViewModel(layerContext.Name, layerContext.Alias, overlay, layerContext.GeoDataManager));
            }

            throw new NotSupportedException(string.Format("layer content style {0} not supported.", layerContext.StyleType));
        }
Esempio n. 16
0
        public DefaultItemizedOverlay CreatePointOverlay(PointStyleInfo styleInfo, AssetManager assetManager, AnnotationView annotationView = null)
        {
            var drawable = CreateDrawable(styleInfo, assetManager);
            var overlay  = new DefaultItemizedOverlay(drawable);

            overlay.SetTapListener(new TapOverlayListener(overlay, annotationView));
            return(overlay);
        }
Esempio n. 17
0
        public VectorOverlay CreateVectorOverlay(Style style, AssetManager assetManager, AnnotationView annotationView = null)
        {
//            var drawable = CreateDrawable(styleInfo, assetManager);
            var overlay = new VectorOverlay();

            overlay.AddCustomStyle(style);
            return(overlay);
        }
Esempio n. 18
0
 public TapOverlayListener(DefaultItemizedOverlay overlay, AnnotationView annotationView)
 {
     _overlay = overlay;
     _annotationView = annotationView;
 }
        void ReleaseDesignerOutlets()
        {
            if (AnnotationButton != null)
            {
                AnnotationButton.Dispose();
                AnnotationButton = null;
            }

            if (AnnotationView != null)
            {
                AnnotationView.Dispose();
                AnnotationView = null;
            }

            if (BackgroudView != null)
            {
                BackgroudView.Dispose();
                BackgroudView = null;
            }

            if (BookContentView != null)
            {
                BookContentView.Dispose();
                BookContentView = null;
            }

            if (ContentButton != null)
            {
                ContentButton.Dispose();
                ContentButton = null;
            }

            if (FunctionButtonView != null)
            {
                FunctionButtonView.Dispose();
                FunctionButtonView = null;
            }

            if (GotoButton != null)
            {
                GotoButton.Dispose();
                GotoButton = null;
            }

            if (IndexButton != null)
            {
                IndexButton.Dispose();
                IndexButton = null;
            }

            if (IndexCustomView != null)
            {
                IndexCustomView.Dispose();
                IndexCustomView = null;
            }

            if (IndexViewController != null)
            {
                IndexViewController.Dispose();
                IndexViewController = null;
            }

            if (LeftButton != null)
            {
                LeftButton.Dispose();
                LeftButton = null;
            }

            if (PageNumber != null)
            {
                PageNumber.Dispose();
                PageNumber = null;
            }

            if (PageViewController != null)
            {
                PageViewController.Dispose();
                PageViewController = null;
            }

            if (RightButton != null)
            {
                RightButton.Dispose();
                RightButton = null;
            }

            if (TocCustomView != null)
            {
                TocCustomView.Dispose();
                TocCustomView = null;
            }

            if (TOCViewController != null)
            {
                TOCViewController.Dispose();
                TOCViewController = null;
            }

            if (AnnotationsVC != null)
            {
                AnnotationsVC.Dispose();
                AnnotationsVC = null;
            }
        }
 /// <summary>
 /// The mouse wheel is moved on annotation view
 /// </summary>
 /// <param name="annotationView">The annotation view.</param>
 /// <param name="e">The <see cref="ObjectPropertyChangedEventArgs"/> instance containing the event data.</param>
 protected override void OnMouseWheel(AnnotationView annotationView, MouseEventArgs e)
 {
     AddMouseEventLogMessage(annotationView, "MouseWheel", e);
 }
 /// <summary>
 /// The mouse is double clicked on annotation view.
 /// </summary>
 /// <param name="annotationView">The annotation view.</param>
 /// <param name="e">The <see cref="ObjectPropertyChangedEventArgs"/> instance containing the event data.</param>
 protected override void OnDoubleClick(AnnotationView annotationView, MouseEventArgs e)
 {
     AddMouseEventLogMessage(annotationView, "DoubleClick", e);
 }
Esempio n. 22
0
 public TapOverlayListener(DefaultItemizedOverlay overlay, AnnotationView annotationView)
 {
     _overlay        = overlay;
     _annotationView = annotationView;
 }
        /// <summary>
        /// Groups/ungroups selected annotations of annotation collection.
        /// </summary>
        /// <param name="annotationViewer">The annotation viewer.</param>
        /// <param name="undoManager">The undo manager.</param>
        public static void GroupUngroupSelectedAnnotations(AnnotationViewer annotationViewer, CompositeUndoManager undoManager)
        {
            // cancel annotation building
            annotationViewer.CancelAnnotationBuilding();

            // get selected annotations
            Collection <AnnotationView> selectedAnnotations = annotationViewer.AnnotationVisualTool.SelectedAnnotations;

            if (selectedAnnotations.Count == 0)
            {
                return;
            }

            // if several annotations are selected
            if (selectedAnnotations.Count > 1)
            {
                // begin the composite undo action
                undoManager.BeginCompositeAction("Group annotations");

                try
                {
                    // create group annotation data
                    GroupAnnotationData groupAnnotationData = new GroupAnnotationData();
                    // create annotation view array
                    AnnotationView[] annotations = new AnnotationView[selectedAnnotations.Count];
                    // copy selected annotations to array
                    selectedAnnotations.CopyTo(annotations, 0);
                    // for each annotation in array
                    foreach (AnnotationView view in annotations)
                    {
                        groupAnnotationData.Items.Add(view.Data);
                        annotationViewer.AnnotationDataCollection.Remove(view.Data);
                    }
                    // add group annotation to viewer
                    annotationViewer.AnnotationDataCollection.Add(groupAnnotationData);
                    // update focused annotation data
                    annotationViewer.FocusedAnnotationData = groupAnnotationData;
                    // update selected annotations
                    annotationViewer.AnnotationVisualTool.SelectedAnnotations.Clear();
                    annotationViewer.AnnotationVisualTool.SelectedAnnotations.Add(annotationViewer.FocusedAnnotationView);
                }
                finally
                {
                    // end the composite undo action
                    undoManager.EndCompositeAction();
                }
            }
            else
            {
                GroupAnnotationView groupAnnotationView = annotationViewer.AnnotationVisualTool.SelectedAnnotations[0] as GroupAnnotationView;
                // if focused annotation is group
                if (groupAnnotationView != null)
                {
                    // begin the composite undo action
                    undoManager.BeginCompositeAction("Ungroup annotations");

                    try
                    {
                        // clear selected annotations
                        selectedAnnotations.Clear();

                        // get annotation data
                        GroupAnnotationData groupAnnotationData = (GroupAnnotationData)groupAnnotationView.Data;
                        // remove group annotation from annotation data collection
                        annotationViewer.AnnotationDataCollection.Remove(groupAnnotationData);
                        // add group annotation items to annotation data collection
                        annotationViewer.AnnotationDataCollection.AddRange(groupAnnotationData.Items.ToArray());
                        // if the annotation viewer allows multiple selection of annotations
                        if (annotationViewer.AnnotationMultiSelect)
                        {
                            // for each annotation data in group annotation items
                            foreach (AnnotationData itemData in groupAnnotationData.Items)
                            {
                                selectedAnnotations.Add(annotationViewer.AnnotationViewCollection.FindView(itemData));
                            }
                        }

                        // remove annotations from group annotation
                        groupAnnotationData.Items.Clear();
                        // dispose group annotation
                        groupAnnotationData.Dispose();
                    }
                    finally
                    {
                        // end the composite undo action
                        undoManager.EndCompositeAction();
                    }
                }
            }
        }
 /// <summary>
 /// The mouse is double clicked on annotation.
 /// </summary>
 /// <param name="annotationView">The annotation view.</param>
 /// <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param>
 protected virtual void OnDoubleClick(AnnotationView annotationView, MouseEventArgs e)
 {
 }
 /// <summary>
 /// The mouse enters the annotation.
 /// </summary>
 /// <param name="annotationView">The annotation view.</param>
 /// <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param>
 protected virtual void OnMouseEnter(AnnotationView annotationView, MouseEventArgs e)
 {
 }
        private void SetupMap(MapView map, Point center, int zoomLevel)
        {
            map.Controller.SetZoom(zoomLevel);
            map.Controller.SetCenter(new GeoPoint(center.Y, center.X));
            map.SetBuiltInZoomControls(true);

            _annotationView = new AnnotationView(map);
        }
Esempio n. 27
0
        void ReleaseDesignerOutlets()
        {
            if (AnnotationButton != null)
            {
                AnnotationButton.Dispose();
                AnnotationButton = null;
            }

            if (AnnotationView != null)
            {
                AnnotationView.Dispose();
                AnnotationView = null;
            }

            if (BackgroudView != null)
            {
                BackgroudView.Dispose();
                BackgroudView = null;
            }

            if (BookContentView != null)
            {
                BookContentView.Dispose();
                BookContentView = null;
            }

            if (ContentButton != null)
            {
                ContentButton.Dispose();
                ContentButton = null;
            }

            if (FunctionButtonView != null)
            {
                FunctionButtonView.Dispose();
                FunctionButtonView = null;
            }

            if (HistoryButton != null)
            {
                HistoryButton.Dispose();
                HistoryButton = null;
            }

            if (IndexButton != null)
            {
                IndexButton.Dispose();
                IndexButton = null;
            }

            if (IndexCustomView != null)
            {
                IndexCustomView.Dispose();
                IndexCustomView = null;
            }

            if (IndexViewController != null)
            {
                IndexViewController.Dispose();
                IndexViewController = null;
            }

            if (InfoButton != null)
            {
                InfoButton.Dispose();
                InfoButton = null;
            }

            if (LeftButton != null)
            {
                LeftButton.Dispose();
                LeftButton = null;
            }

            if (PageNumber != null)
            {
                PageNumber.Dispose();
                PageNumber = null;
            }

            if (PageViewController != null)
            {
                PageViewController.Dispose();
                PageViewController = null;
            }

            if (RightButton != null)
            {
                RightButton.Dispose();
                RightButton = null;
            }

            if (SearchField != null)
            {
                SearchField.Dispose();
                SearchField = null;
            }

            if (SegmentContol != null)
            {
                SegmentContol.Dispose();
                SegmentContol = null;
            }

            if (ShareButton != null)
            {
                ShareButton.Dispose();
                ShareButton = null;
            }

            if (SplitSwithButton != null)
            {
                SplitSwithButton.Dispose();
                SplitSwithButton = null;
            }

            if (TitleTField != null)
            {
                TitleTField.Dispose();
                TitleTField = null;
            }

            if (TocCustomView != null)
            {
                TocCustomView.Dispose();
                TocCustomView = null;
            }

            if (TOCViewController != null)
            {
                TOCViewController.Dispose();
                TOCViewController = null;
            }

            if (GotoButton != null)
            {
                GotoButton.Dispose();
                GotoButton = null;
            }
        }