示例#1
0
        public override bool Equals(object obj)
        {
            if (!(obj is EditSketch))
            {
                return(false);
            }
            if (this == obj)
            {
                return(true);
            }

            EditSketch sketch = (EditSketch)obj;

            if (_geometry != null && !_geometry.Equals(sketch._geometry))
            {
                return(false);
            }
            if (_geometry == null && sketch._geometry != null)
            {
                return(false);
            }

            if (_symbol != null && sketch._symbol != null &&
                !_symbol.GetType().Equals(sketch._symbol.GetType()))
            {
                return(false);
            }

            return(true);
        }
示例#2
0
        //private void SetFeatureClassAndFeature(IFeatureClass fc, IFeature feature)
        //{
        //    if (_fc == fc && _feature == feature) return;

        //    _fc = fc;
        //    _feature = feature;

        //    if (_feature == null || feature.Shape == null)
        //        Sketch = null;
        //    else
        //        Sketch = new EditSketch(feature.Shape);

        //    if (OnChangeSelectedFeature != null)
        //        OnChangeSelectedFeature(this, fc, feature);
        //}
        internal void CreateStandardFeature()
        {
            if (_fc == null)
            {
                return;
            }

            Feature feature = new Feature();

            geometryType gType = _fc.GeometryType;

            if (gType == geometryType.Unknown)
            {
                FormChooseGeometry dlg = new FormChooseGeometry();
                if (dlg.ShowDialog() != DialogResult.OK)
                {
                    this.Sketch = null;
                    return;
                }
                gType = dlg.GeometryType;
            }
            switch (gType)
            {
            case geometryType.Point:
                feature.Shape = new gView.Framework.Geometry.Point();
                break;

            case geometryType.Multipoint:
                feature.Shape = new MultiPoint();
                break;

            case geometryType.Polyline:
                feature.Shape = new Polyline();
                break;

            case geometryType.Polygon:
                feature.Shape = new Polygon();
                break;

            default:
                return;
            }
            _feature = feature;

            if (OnCreateStandardFeature != null)
            {
                OnCreateStandardFeature(this, _feature);
            }

            Sketch = new EditSketch(_feature.Shape);
        }