Instances of this class contains a data passed to the feature operation event.
Inheritance: System.EventArgs
Beispiel #1
0
        //private IGeometry geometryFromMapRecord(MapFileRecord record)
        //{
        //    switch (record.ShapeType)
        //    {
        //        // point
        //        case 1:
        //            return new PointD(record.Points[0].X, record.Points[0].Y);
        //        // polyline
        //        case 3:
        //            Polyline polyline = new Polyline();
        //            for (int i = 0; i < record.Parts.Count; i++)
        //            {
        //                LinePath path = new LinePath();
        //                int j;
        //                for (j = record.Parts[i]; j < (i == record.Parts.Count - 1 ? record.Points.Count : record.Parts[i + 1]); j++)
        //                    path.Vertices.Add(PlanimetryEnvironment.NewCoordinate(record.Points[j].X, record.Points[j].Y));

        //                polyline.Paths.Add(path);
        //            }
        //            return polyline;
        //        // ground
        //        case 5:
        //            Polygon p = new Polygon();
        //            for (int i = 0; i < record.Parts.Count; i++)
        //            {
        //                Contour contour = new Contour();
        //                int j;
        //                for (j = record.Parts[i]; j < (i == record.Parts.Count - 1 ? record.Points.Count : record.Parts[i + 1]); j++)
        //                    contour.Vertices.Add(PlanimetryEnvironment.NewCoordinate(record.Points[j].X, record.Points[j].Y));

        //                contour.Vertices.RemoveAt(contour.Vertices.Count - 1);
        //                p.Contours.Add(contour);
        //            }
        //            if (p.CoordinateCount > 0)
        //                return p;
        //            else
        //                return null;
        //        // set of points
        //        case 8:
        //            MultiPoint mp = new MultiPoint();
        //            for (int i = 0; i < record.Points.Count; i++)
        //                mp.Points.Add(PlanimetryEnvironment.NewCoordinate(record.Points[i].X, record.Points[i].Y));
        //            return mp;
        //    }

        //    return null;
        //}

        private bool processFeature(Feature feature, IFeatureReceiver fr, List <Feature> points,
                                    List <Feature> multiPoints,
                                    List <Feature> polylines,
                                    List <Feature> polygons)
        {
            if (feature == null)
            {
                return(false);
            }

            bool isAccepted = true;

            if (FeatureFetched != null)
            {
                FeatureOperationEventArgs foea = new FeatureOperationEventArgs(feature);
                FeatureFetched(this, foea);
                isAccepted = foea.IsAccepted;
            }

            if (!isAccepted)
            {
                return(false);
            }

            fr.AddFeature(feature);
            switch (feature.FeatureType)
            {
            case FeatureType.Point: points.Add(feature); break;

            case FeatureType.MultiPoint: multiPoints.Add(feature); break;

            case FeatureType.Polyline: polylines.Add(feature); break;

            case FeatureType.Polygon: polygons.Add(feature); break;
            }

            return(true);
        }
        private bool addFeatureToReceiver(IFeatureReceiver fr, string uniqKey, string title, byte[] spatialData)
        {
            Feature feature = FeatureFromSpatialDataBytes(spatialData);

            feature.UniqKey = uniqKey;
            feature.Title   = title;

            bool isAccepted = true;

            if (FeatureFetched != null)
            {
                FeatureOperationEventArgs foea = new FeatureOperationEventArgs(feature);
                FeatureFetched(this, foea);
                isAccepted = foea.IsAccepted;
            }

            if (isAccepted)
            {
                fr.AddFeature(feature);
            }

            return(isAccepted);
        }
        private bool addFeatureToReceiver(IFeatureReceiver fr, string uniqKey, string title, byte[] spatialData)
        {
            Feature feature = FeatureFromSpatialDataBytes(spatialData);
            feature.UniqKey = uniqKey;
            feature.Title = title;

            bool isAccepted = true;
            if (FeatureFetched != null)
            {
                FeatureOperationEventArgs foea = new FeatureOperationEventArgs(feature);
                FeatureFetched(this, foea);
                isAccepted = foea.IsAccepted;
            }

            if(isAccepted)
                fr.AddFeature(feature);

            return isAccepted;
        }
        private bool processFeature(Feature feature, IFeatureReceiver fr, List<Feature> points,
            List<Feature> multiPoints,
            List<Feature> polylines,
            List<Feature> polygons)
        {
            if (feature == null)
                return false;

            bool isAccepted = true;
            if (FeatureFetched != null)
            {
                FeatureOperationEventArgs foea = new FeatureOperationEventArgs(feature);
                FeatureFetched(this, foea);
                isAccepted = foea.IsAccepted;
            }

            if (!isAccepted)
                return false;

            fr.AddFeature(feature);
            switch (feature.FeatureType)
            {
                case FeatureType.Point: points.Add(feature); break;
                case FeatureType.MultiPoint: multiPoints.Add(feature); break;
                case FeatureType.Polyline: polylines.Add(feature); break;
                case FeatureType.Polygon: polygons.Add(feature); break;
            }

            return true;
        }