Ejemplo n.º 1
0
        /// <summary>
        /// Spatial query using DotSpatial
        /// </summary>
        /// <param name="featureSet">FeatureSet</param>
        /// <param name="geometry">Spatial geometry</param>
        /// <returns>Selected features</returns>
        public static IFeatureSet SpatialQuery(IFeatureSet featureSet, IGeometry geometry)
        {
            List <IFeature> features = new List <IFeature>();

            for (int i = 0; i < featureSet.Features.Count; i++)
            {
                if (RelateOp.Relate(featureSet.Features[i].Geometry, geometry).IsIntersects())
                {
                    features.Add(featureSet.Features[i]);
                }
            }

            FeatureSet result = new FeatureSet(features);

            result.Projection = CloneableEM.Copy(featureSet.Projection);
            result.InvalidateEnvelope(); // the new set will likely have a different envelope bounds

            return(result);
        }
Ejemplo n.º 2
0
        private void ShowPropertiesClick(object sender, EventArgs e)
        {
            // Allow subclasses to prevent this class from showing the default dialog
            HandledEventArgs result = new HandledEventArgs(false);

            OnShowProperties(result);
            if (result.Handled)
            {
                return;
            }

            if (_propertyDialogProvider == null)
            {
                return;
            }
            var editCopy = CloneableEM.Copy(this);

            CopyProperties(editCopy); // for some reason we are getting blank layers during edits, this tries to fix that
            _propertyDialogProvider.ShowDialog(editCopy);
            editCopy.Dispose();
            LayerManager.DefaultLayerManager.ActiveProjectLayers = new List <ILayer>();
        }