当前位置: 首页>>代码示例>>C#>>正文


C# Features.Add方法代码示例

本文整理汇总了C#中Features.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Features.Add方法的具体用法?C# Features.Add怎么用?C# Features.Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Features的用法示例。


在下文中一共展示了Features.Add方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetFeaturesInView

 public System.Collections.Generic.IEnumerable<IFeature> GetFeaturesInView(BoundingBox box, double resolution)
 {
     var features = new Features();
     IRaster raster = null;
     var view = new Viewport { Resolution = resolution, Center = box.GetCentroid(), Width = (box.Width / resolution), Height = (box.Height / resolution) };
     if (TryGetMap(view, ref raster))
     {
         IFeature feature = features.New();
         feature.Geometry = raster;
         features.Add(feature);
     }
     return features;
 }
开发者ID:HackatonArGP,项目名称:Guardianes,代码行数:13,代码来源:ArcGISImageServiceProvider.cs

示例2: GetFeaturesInView

        public IEnumerable<IFeature> GetFeaturesInView(BoundingBox box, double resolution)
        {
            //If there are no layers (probably not initialised) return nothing
            if (Capabilities.layers == null)
                return new Features();

            IFeatures features = new Features();
            IRaster raster = null;
            IViewport viewport = new Viewport { Resolution = resolution, Center = box.GetCentroid(), Width = (box.Width / resolution), Height = (box.Height / resolution) };
            if (TryGetMap(viewport, ref raster))
            {
                var feature = features.New();
                feature.Geometry = raster;
                features.Add(feature);
            }
            return features;
        }
开发者ID:HackatonArGP,项目名称:Guardianes,代码行数:17,代码来源:ArcGisDynamicProvider.cs

示例3: FetchTiles

        public IFeatures FetchTiles(BoundingBox boundingBox, double resolution)
        {
            Extent extent = new Extent(boundingBox.Min.X, boundingBox.Min.Y, boundingBox.Max.X, boundingBox.Max.Y);
            int level = BruTile.Utilities.GetNearestLevel(source.Schema.Resolutions, resolution);
            IList<TileInfo> tiles = source.Schema.GetTilesInView(extent, level);

            ICollection<WaitHandle> waitHandles = new List<WaitHandle>();
                        
            foreach (TileInfo info in tiles)    
            {
                if (bitmaps.Find(info.Index) != null) continue;
                if (queue.Contains(info.Index)) continue;
                AutoResetEvent waitHandle = new AutoResetEvent(false);
                waitHandles.Add(waitHandle);
                queue.Add(info.Index);

                Thread thread = new Thread(GetTileOnThread);
                thread.Start(new object[] { source.Provider, info, bitmaps, waitHandle });
                //!!!ThreadPool.QueueUserWorkItem(GetTileOnThread, new object[] { source.Provider, info, bitmaps, waitHandle });
            }

            //foreach (WaitHandle handle in waitHandles)
            //    handle.WaitOne();

            IFeatures features = new Features();
            foreach (TileInfo info in tiles)
            {
                byte[] bitmap = bitmaps.Find(info.Index);
                if (bitmap == null) continue;
                IRaster raster = new Raster(bitmap, new BoundingBox(info.Extent.MinX, info.Extent.MinY, info.Extent.MaxX, info.Extent.MaxY));
                IFeature feature = features.New();
                feature.Geometry = raster;
                features.Add(feature);
            }
            return features;
        }
开发者ID:sridhar19091986,项目名称:sharpmapx,代码行数:36,代码来源:TileProvider.cs

示例4: GetFeaturesInView

 public IFeatures GetFeaturesInView(Envelope box, double resolution)
 {
     IFeatures results = new Features();
     foreach (IFeature feature in _Features)
     {
         if (feature.Geometry.EnvelopeInternal.Intersects(box))
         {
             results.Add(feature);
         }
     }
     return results;
 }
开发者ID:sridhar19091986,项目名称:sharpmapx,代码行数:12,代码来源:MemoryProvider.cs

示例5: MemoryProvider

 /// <summary>
 /// Initializes a new instance of the <see cref="MemoryProvider"/>
 /// </summary>
 /// <param name="geometry">Geometry to be in this datasource</param>
 public MemoryProvider(Geometry geometry)
 {
     _Features = new Features();
     IFeature feature = _Features.New();
     feature.Geometry = geometry;
     _Features.Add(feature);
 }
开发者ID:sridhar19091986,项目名称:sharpmapx,代码行数:11,代码来源:MemoryProvider.cs

示例6: CreateGeometries

        /// <summary>
        /// This method produces instances of type <see cref="Mapsui.Geometries.MultiPolygon"/>.
        /// </summary>
        /// <returns>The created geometries</returns>
        internal override Collection<Geometry> CreateGeometries(Features features)
        {
            IPathNode multiPolygonNode = new PathNode(Gmlns, "MultiPolygon", (NameTable) XmlReader.NameTable);
            IPathNode multiSurfaceNode = new PathNode(Gmlns, "MultiSurface", (NameTable) XmlReader.NameTable);
            IPathNode multiPolygonNodeAlt = new AlternativePathNodesCollection(multiPolygonNode, multiSurfaceNode);
            IPathNode polygonMemberNode = new PathNode(Gmlns, "polygonMember", (NameTable) XmlReader.NameTable);
            IPathNode surfaceMemberNode = new PathNode(Gmlns, "surfaceMember", (NameTable) XmlReader.NameTable);
            IPathNode polygonMemberNodeAlt = new AlternativePathNodesCollection(polygonMemberNode, surfaceMemberNode);
            IPathNode linearRingNode = new PathNode(Gmlns, "LinearRing", (NameTable) XmlReader.NameTable);
            var labelValue = new string[1];
            bool geomFound = false;

            try
            {
                // Reading the entire feature's node makes it possible to collect label values that may appear before or after the geometry property
                while ((FeatureReader = GetSubReaderOf(XmlReader, null, FeatureNode)) != null)
                {
                    while (
                        (GeomReader =
                         GetSubReaderOf(FeatureReader, labelValue, multiPolygonNodeAlt, polygonMemberNodeAlt)) != null)
                    {
                        var multiPolygon = new MultiPolygon();
                        GeometryFactory geomFactory = new PolygonFactory(GeomReader, FeatureTypeInfo);
                        Collection<Geometry> polygons = geomFactory.CreateGeometries(features);

                        foreach (Polygon polygon in polygons)
                            multiPolygon.Polygons.Add(polygon);

                        Geoms.Add(multiPolygon);
                        geomFound = true;
                    }
                    if (geomFound) features.Add(CreateFeature(Geoms[Geoms.Count - 1], FeatureTypeInfo.LableField, labelValue[0]));
                    geomFound = false;
                }
            }
            catch (Exception ex)
            {
                Trace.TraceError("An exception occured while parsing a multi-polygon geometry: " + ex.Message);
                throw;
            }

            return Geoms;
        }
开发者ID:jdeksup,项目名称:Mapsui.Net4,代码行数:47,代码来源:GeometryFactories.cs

示例7: GetFeatures

 public void GetFeatures(Features feats, string precedence)
 {
     feats.Add(precedence + FeatureNames.textClass, new FeatureValue(((double)textClass)));
     feats.Add(precedence + FeatureNames.relPosition, new FeatureValue(relPosition));
     feats.Add(precedence + FeatureNames.charCount, new FeatureValue(charCount));
     feats.Add(precedence + FeatureNames.numWords, new FeatureValue(numWords));
     feats.Add(precedence + FeatureNames.linkDensity, new FeatureValue(linkDensity));
     feats.Add(precedence + FeatureNames.textDensity, new FeatureValue(textDensity));
     feats.Add(precedence + FeatureNames.avgWordLen, new FeatureValue(avgWordLen));
     feats.Add(precedence + FeatureNames.fullstopRatio, new FeatureValue(fullstopRatio));
     feats.Add(precedence + FeatureNames.capitalWordsRatio, new FeatureValue(capitalWordsRatio));
     feats.Add(precedence + FeatureNames.capitalStartWordsRatio, new FeatureValue(capitalStartWordsRatio));
     feats.Add(precedence + FeatureNames.numWordsQuotPC, new FeatureValue(numWordsQuotPC));
     feats.Add(precedence + FeatureNames.textDensityQuotPC, new FeatureValue(textDensityQuotPC));
     feats.Add(precedence + FeatureNames.isInP, new FeatureValue((double)(isInP ? 1 : 0)));
     feats.Add(precedence + FeatureNames.isInH, new FeatureValue((double)(isInH ? 1 : 0)));
 }
开发者ID:viidea,项目名称:latino,代码行数:17,代码来源:BoilerplateRemover.cs

示例8: GetFeaturesInView

        public IEnumerable<IFeature> GetFeaturesInView(BoundingBox box, double resolution)
        {
            lock (_syncRoot)
            {
                Open();
                try
                {
                    //Use the spatial index to get a list of features whose boundingbox intersects bbox
                    var objectlist = GetObjectIDsInView(box);
                    var features = new Features();

                    foreach (var index in objectlist)
                    {
                        var feature = _dbaseFile.GetFeature(index, features);
                        feature.Geometry = ReadGeometry(index);
                        if (feature.Geometry == null) continue;
                        if (!feature.Geometry.GetBoundingBox().Intersects(box)) continue;
                        if (FilterDelegate != null && !FilterDelegate(feature)) continue;
                        features.Add(feature);
                    }
                    return features;
                }
                finally
                {
                    Close();
                }
            }
        }
开发者ID:pauldendulk,项目名称:Mapsui,代码行数:28,代码来源:ShapeFile.cs

示例9: GetFeaturesInView

        public IFeatures GetFeaturesInView(BoundingBox bbox, double resolution)
        {
            //Use the spatial index to get a list of features whose boundingbox intersects bbox
            Collection<uint> objectlist = GetObjectIDsInView(bbox);
            IFeatures dt = new Features();

            foreach (uint index in objectlist)
            {
                IFeature fdr = dbaseFile.GetFeature(index, dt);
                fdr.Geometry = ReadGeometry(index);
                if (fdr.Geometry != null)
                    if (fdr.Geometry.GetBoundingBox().Intersects(bbox))
                        if (FilterDelegate == null || FilterDelegate(fdr))
                            dt.Add(fdr);
            }
            return dt;
        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:17,代码来源:ShapeFile.cs

示例10: GetFeatures

        private Features GetFeatures(List<FeatureTemplate> list, Token token, IndexedSentence sentence, bool? local = null)
        {
            Features features = new Features(list.Count);

            foreach (FeatureTemplate template in list)
            {
                if (local == null || local == template.IsLocal)
                {
                    features.Add(template.Name, template.GetValue(token, sentence));
                }
            }

            return features;
        }
开发者ID:pdonald,项目名称:latvian,代码行数:14,代码来源:PerceptronTagger.cs

示例11: CreateGeometries

        /// <summary>
        /// This method produces instances of type <see cref="Mapsui.Geometries.MultiPoint"/>.
        /// </summary>
        /// <returns>The created geometries</returns>
        internal override Collection<Geometry> CreateGeometries(Features features)
        {
            IPathNode multiPointNode = new PathNode(Gmlns, "MultiPoint", (NameTable) XmlReader.NameTable);
            IPathNode pointMemberNode = new PathNode(Gmlns, "pointMember", (NameTable) XmlReader.NameTable);
            var labelValue = new string[1];
            bool geomFound = false;

            try
            {
                // Reading the entire feature's node makes it possible to collect label values that may appear before or after the geometry property
                while ((FeatureReader = GetSubReaderOf(XmlReader, null, FeatureNode)) != null)
                {
                    while (
                        (GeomReader = GetSubReaderOf(FeatureReader, labelValue, multiPointNode, pointMemberNode)) !=
                        null)
                    {
                        var multiPoint = new MultiPoint();
                        GeometryFactory geomFactory = new PointFactory(GeomReader, FeatureTypeInfo);
                        Collection<Geometry> points = geomFactory.CreateGeometries(features);

                        foreach (var geometry in points)
                        {
                            var point = (Point) geometry;
                            multiPoint.Points.Add(point);
                        }

                        Geoms.Add(multiPoint);
                        geomFound = true;
                    }
                    if (geomFound) features.Add(CreateFeature(Geoms[Geoms.Count - 1], FeatureTypeInfo.LableField, labelValue[0]));
                    geomFound = false;
                }
            }
            catch (Exception ex)
            {
                Trace.TraceError("An exception occured while parsing a multi-point geometry: " + ex.Message);
                throw;
            }

            return Geoms;
        }
开发者ID:pauldendulk,项目名称:Mapsui,代码行数:45,代码来源:GeometryFactories.cs


注:本文中的Features.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。