/// <summary>
        /// Create a new element for the Trail Layer
        /// </summary>
        /// <param name="element">The element to add</param>
        private void NewTrail(RedliningElement element)
        {
            // Switch off the submenu
            SubMenuIsActive = false;

            MapView.TrailLayer.NewElement(element);
        }
        /// <summary>
        /// Create a new element for the Trail Layer
        /// </summary>
        /// <param name="element">The element to add</param>
        ///

        private void NewTrail(RedliningElement element)
        {
            // Switch off the submenu
            //SubMenuIsActive = false;

            //Desactivar, si  ya no genera la imagen solo el triangulo rojo
            MapView.TrailLayer.NewElement(element);
            //MarcaActiva = true;

            //Activa el triangulo rojo
            //MainPage objMarca = new MainPage();
            //objMarca.chkMarca2.IsChecked=true ;
        }
        /// <summary>
        /// Returns an edit element for the specified fieldDescriptor
        /// </summary>
        private RedliningElement ElementFor(FeatureGeometryFieldDescriptor fieldDescriptor, IFeatureGeometry geometry)
        {
            RedliningElement redliningElement = null;
            var model     = this.DrawingModel;
            var selection = this.DrawingSelection;

            if (model != null && selection != null)
            {
                foreach (var element in model)
                {
                    if ((element.Tag as FeatureGeometryFieldDescriptor) == fieldDescriptor)
                    {
                        redliningElement = element;
                        break;
                    }
                }

                if (redliningElement != null)
                {
                    selection.Set(redliningElement);
                }
                else
                {
                    if (geometry != null)
                    {
                        // Set the geometry to the correct coordinate system
                        geometry = geometry.InCoordinateSystem(this.CoordinateSystem);

                        // Get the redlining element
                        redliningElement = RedliningElement.ElementFor(geometry);

                        // Make sure the element is decorated
                        MapView.EditGeometryLayer.DecorateElement(redliningElement);

                        model.Add(redliningElement);
                        selection.Set(redliningElement);
                    }
                    else
                    {
                        redliningElement = RedliningElement.Create(fieldDescriptor.FieldType.PhysicalType, CoordinateSystem);
                        MapView.EditGeometryLayer.NewElement(redliningElement);
                    }

                    // Make sure we are using the cache properly
                    redliningElement.Tag = fieldDescriptor;
                }
            }

            return(redliningElement);
        }
        /// <summary>
        /// Handles the stopping of editing geometry
        /// </summary>
        private void StopEditingGeometry(FeatureGeometryFieldDescriptor fieldDescriptor = null)
        {
            // Get the mapView to interact upon
            var mapView   = MapView;
            var editLayer = EditGeometryLayer;
            var model     = this.DrawingModel;
            var selection = this.DrawingSelection;

            IsEditing = false;

            if (model != null && selection != null)
            {
                selection.Clear();

                if (fieldDescriptor != null)
                {
                    RedliningElement elementToRemove = null;

                    foreach (var element in model.Elements())
                    {
                        if (element.Tag == fieldDescriptor)
                        {
                            elementToRemove = element;
                            break;
                        }
                    }

                    if (elementToRemove != null)
                    {
                        model.Remove(elementToRemove);
                    }
                }
                else
                {
                    // No specific geometry; just clear the model
                    ClearModel();
                }
            }

            if (editLayer != null)
            {
                // Make sure we explicitly cancel all interaction in case the last interaction
                // mode was activated by a New-Geometry action
                editLayer.StopInteraction();
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Create a trail from the selection
        /// </summary>
        private void CreateTrailFromSelection()
        {
            var mapView = MapViewModel;

            ClosePopupMenu();

            if (mapView != null)
            {
                var trailLayer      = mapView.TrailLayer;
                var selectedElement = mapView.SelectedFeatureGeometry.Count > 0 ? mapView.SelectedFeatureGeometry[0] : null;

                if (selectedElement != null && selectedElement.Feature.TableDescriptor.Name != SpatialEye.Framework.Client.MapViewModel.TrailTableDescriptorName)
                {
                    var redliningElement = RedliningElement.ElementFor(selectedElement.TargetGeometry);
                    if (redliningElement != null)
                    {
                        trailLayer.Drawing.Add(redliningElement);
                        trailLayer.DrawingSelection.Set(redliningElement);
                    }
                }
            }
        }