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


C# IFeatureClass.WhereClauseByExtensionVersion方法代码示例

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


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

示例1: CreateWayRepresentation

        private ESRI.ArcGIS.OSM.OSMClassExtension.way CreateWayRepresentation(IFeatureClass featureClass, string action, long osmID, string changeSetID, int osmVersion, Dictionary<long, long> osmIDLookup, IFeatureClass pointFeatureClass, int pointOSMIDFieldIndex, int extensionVersion)
        {
            way wayRepresentation = new way();

            // let's find all the rows that have a different status than 200 - meaning success
            IQueryFilter queryFilter = new QueryFilterClass();
            queryFilter.WhereClause = featureClass.WhereClauseByExtensionVersion(osmID, "OSMID", extensionVersion);

            using (ComReleaser comReleaser = new ComReleaser())
            {
                IFeatureCursor searchCursor = featureClass.Search(queryFilter, false);
                comReleaser.ManageLifetime(searchCursor);

                IFeature wayFeature = searchCursor.NextFeature();

                int osmTagsFieldIndex = featureClass.Fields.FindField("osmTags");
                int osmIDFieldIndex = featureClass.Fields.FindField("osmID");
                int osmUserFieldIndex = featureClass.Fields.FindField("osmuser");
                int osmUIDFieldIndex = featureClass.Fields.FindField("osmuid");
                int osmVisibleFieldIndex = featureClass.Fields.FindField("osmvisible");
                int osmVersionFieldIndex = featureClass.Fields.FindField("osmversion");

                if (wayFeature != null)
                {
                    switch (action)
                    {
                        case "create":
                            // the newly created node needs to carry the changeset info, the coordinate and the tags
                            wayRepresentation.changeset = changeSetID;

                            tag[] tags = null;
                            if (osmTagsFieldIndex > -1)
                            {
                                tags = _osmUtility.retrieveOSMTags((IRow)wayFeature, osmTagsFieldIndex, ((IDataset)featureClass).Workspace);
                            }

                            List<tag> valueOnlyTags = new List<tag>();

                            for (int index = 0; index < tags.Length; index++)
                            {
                                if (!String.IsNullOrEmpty(tags[index].v))
                                {
                                    valueOnlyTags.Add(tags[index]);
                                }
                            }

                            wayRepresentation.tag = valueOnlyTags.ToArray();

                            if (osmIDFieldIndex > -1)
                            {
                                wayRepresentation.id = osmID.ToString();
                            }

                            List<nd> nodeList = new List<nd>();

                            IPointCollection pointCollection = wayFeature.Shape as IPointCollection;
                            IEnumVertex enumVertex = pointCollection.EnumVertices;
                            enumVertex.Reset();

                            IPoint currentPoint = null;
                            int vertexIndex = -1;
                            int partIndex = -1;
                            bool isStoreRequired = false;

                            enumVertex.Next(out currentPoint, out partIndex, out vertexIndex);

                            while (currentPoint != null)
                            {
                                if (osmIDLookup.ContainsKey(currentPoint.ID))
                                {
                                    if (extensionVersion == 1)
                                    {
                                        enumVertex.put_ID(Convert.ToInt32(osmIDLookup[currentPoint.ID]));
                                        isStoreRequired = true;
                                    }
                                    else if (extensionVersion == 2)
                                    {
                                        // the initial established ObjectIDs don't change
                                    }
                                }

                                nd ndElement = new nd();
                                [email protected] = OSMToolHelper.retrieveNodeID(pointFeatureClass, osmIDFieldIndex, extensionVersion, pointCollection.get_Point(vertexIndex));
                                nodeList.Add(ndElement);

                                enumVertex.Next(out currentPoint, out partIndex, out vertexIndex);
                            }

                            // only do a store operation if the vertex IDs have actually changed
                            if (isStoreRequired)
                            {
                                wayFeature.Shape = (IGeometry)pointCollection;
                                wayFeature.Store();
                            }

                            nodeList = CorrectNodeIDs(nodeList);

                            wayRepresentation.nd = nodeList.ToArray();

                            break;
//.........这里部分代码省略.........
开发者ID:weepingdog,项目名称:arcgis-osm-editor,代码行数:101,代码来源:OSMGPUpload.cs

示例2: CreateNodeRepresentation

        private ESRI.ArcGIS.OSM.OSMClassExtension.node CreateNodeRepresentation(IFeatureClass pointFeatureClass, string action, long osmID, string osmChangeSetID, int osmVersion, IPoint deletePoint, int extensionVersion)
        {
            node nodeRepresentation = new node();

            // let's find all the rows that have a different status than 200 - meaning success
            IQueryFilter queryFilter = new QueryFilterClass();
            queryFilter.WhereClause = pointFeatureClass.WhereClauseByExtensionVersion(osmID, "OSMID", extensionVersion);

            using (ComReleaser comReleaser = new ComReleaser())
            {
                IFeatureCursor searchCursor = pointFeatureClass.Search(queryFilter, false);
                comReleaser.ManageLifetime(searchCursor);

                IFeature pointFeature = searchCursor.NextFeature();

                int osmTagsFieldIndex = pointFeatureClass.Fields.FindField("osmTags");
                int osmIDFieldIndex = pointFeatureClass.Fields.FindField("osmID");
                int osmUserFieldIndex = pointFeatureClass.Fields.FindField("osmuser");
                int osmUIDFieldIndex = pointFeatureClass.Fields.FindField("osmuid");
                int osmVisibleFieldIndex = pointFeatureClass.Fields.FindField("osmvisible");
                int osmVersionFieldIndex = pointFeatureClass.Fields.FindField("osmversion");

                IPoint pointGeometry = null;

                if (pointFeature != null)
                {
                    switch (action)
                    {
                        case "create":
                            // the newly created node needs to carry the changeset info, the coordinate and the tags
                            nodeRepresentation.changeset = osmChangeSetID;

                            pointGeometry = pointFeature.Shape as IPoint;
                            pointGeometry.Project(m_wgs84);

                            nodeRepresentation.lat = Convert.ToString(pointGeometry.Y, new CultureInfo("en-US"));
                            nodeRepresentation.lon = Convert.ToString(pointGeometry.X, new CultureInfo("en-US"));

                            tag[] tags = null;
                            if (osmTagsFieldIndex > -1)
                            {
                                tags = _osmUtility.retrieveOSMTags((IRow)pointFeature, osmTagsFieldIndex, ((IDataset)pointFeatureClass).Workspace);
                            }

                            List<tag> valueOnlyTags = new List<tag>();

                            for (int index = 0; index < tags.Length; index++)
                            {
                                if (!String.IsNullOrEmpty(tags[index].v))
                                {
                                    valueOnlyTags.Add(tags[index]);
                                }
                            }

                            nodeRepresentation.tag = valueOnlyTags.ToArray();

                            if (osmIDFieldIndex > -1)
                            {
                                nodeRepresentation.id = Convert.ToString(pointFeature.get_Value(osmIDFieldIndex), new CultureInfo("en-US"));
                            }

                            break;
                        case "modify":
                            // for an update the complete (full) node needs to be returned
                            nodeRepresentation.changeset = osmChangeSetID;

                            pointGeometry = pointFeature.Shape as IPoint;
                            pointGeometry.Project(m_wgs84);

                            nodeRepresentation.lat = Convert.ToString(pointGeometry.Y, new CultureInfo("en-US"));
                            nodeRepresentation.lon = Convert.ToString(pointGeometry.X, new CultureInfo("en-US"));

                            if (osmIDFieldIndex > -1)
                            {
                                nodeRepresentation.id = Convert.ToString(pointFeature.get_Value(osmIDFieldIndex), new CultureInfo("en-US"));
                            }

                            if (osmUserFieldIndex > -1)
                            {
                                nodeRepresentation.user = Convert.ToString(pointFeature.get_Value(osmUserFieldIndex));
                            }

                            if (osmUIDFieldIndex > -1)
                            {
                                nodeRepresentation.uid = Convert.ToString(pointFeature.get_Value(osmUIDFieldIndex), new CultureInfo("en-US"));
                            }

                            if (osmVisibleFieldIndex > -1)
                            {
                                try
                                {
                                    nodeRepresentation.visible = (nodeVisible)Enum.Parse(typeof(nodeVisible), Convert.ToString(pointFeature.get_Value(osmVisibleFieldIndex)));
                                }
                                catch
                                {
                                    nodeRepresentation.visible = [email protected];
                                }
                            }

                            if (osmVersionFieldIndex > -1)
//.........这里部分代码省略.........
开发者ID:weepingdog,项目名称:arcgis-osm-editor,代码行数:101,代码来源:OSMGPUpload.cs

示例3: walkRelationGeometry

        private osmRelationGeometryType walkRelationGeometry(IFeatureClass osmLineFeatureClass, IFeatureClass osmPolygonFeatureClass, ITable relationTable, relation currentRelation)
        {
            osmRelationGeometryType testedGeometry = osmRelationGeometryType.osmUnknownGeometry;

            // we use this dictionary to determine if we can fully walk this relation
            // - the assumption is that we can walk the geometry is all node counts are 2
            Dictionary<int, int> nodeCountDictionary = new Dictionary<int, int>();

            try
            {
                if (currentRelation.Items == null)
                    return testedGeometry;

                foreach (var item in currentRelation.Items)
                {
                    if (item is ESRI.ArcGIS.OSM.OSMClassExtension.member)
                    {
                        member memberItem = item as member;
                        IQueryFilter osmIDQueryFilter = new QueryFilterClass();

                        using (ComReleaser comReleaser = new ComReleaser())
                        {
                            if (osmLineFeatureClass != null)
                            {
                                osmIDQueryFilter.WhereClause = osmLineFeatureClass.WhereClauseByExtensionVersion([email protected], "OSMID", 2);
                                IFeatureCursor lineFeatureCursor = osmLineFeatureClass.Search(osmIDQueryFilter, false);
                                comReleaser.ManageLifetime(lineFeatureCursor);

                                IFeature foundLineFeature = lineFeatureCursor.NextFeature();

                                if (foundLineFeature != null)
                                {
                                    IPointCollection pointCollection = foundLineFeature.Shape as IPointCollection;

                                    int firstPointID = pointCollection.get_Point(0).ID;
                                    int lastPointID = pointCollection.get_Point(pointCollection.PointCount - 1).ID;

                                    if (nodeCountDictionary.ContainsKey(firstPointID))
                                    {
                                        nodeCountDictionary[firstPointID] = nodeCountDictionary[firstPointID] + 1;
                                    }
                                    else
                                    {
                                        nodeCountDictionary.Add(firstPointID, 1);
                                    }

                                    if (nodeCountDictionary.ContainsKey(lastPointID))
                                    {
                                        nodeCountDictionary[lastPointID] = nodeCountDictionary[lastPointID] + 1;
                                    }
                                    else
                                    {
                                        nodeCountDictionary.Add(lastPointID, 1);
                                    }
                                }

                                osmIDQueryFilter.WhereClause = osmPolygonFeatureClass.WhereClauseByExtensionVersion([email protected], "OSMID", 2);
                                IFeatureCursor polygonFeatureCursor = osmPolygonFeatureClass.Search(osmIDQueryFilter, false);
                                comReleaser.ManageLifetime(polygonFeatureCursor);

                                IFeature foundPolygonFeature = polygonFeatureCursor.NextFeature();

                                if (foundPolygonFeature != null)
                                {
                                    IPointCollection pointCollection = foundPolygonFeature.Shape as IPointCollection;

                                    int firstPointID = pointCollection.get_Point(0).ID;

                                    if (nodeCountDictionary.ContainsKey(firstPointID))
                                    {
                                        nodeCountDictionary[firstPointID] = nodeCountDictionary[firstPointID] + 2;
                                    }
                                    else
                                    {
                                        nodeCountDictionary.Add(firstPointID, 2);
                                    }
                                }

                                osmIDQueryFilter.WhereClause = relationTable.WhereClauseByExtensionVersion([email protected], "OSMID", 2);
                                ICursor relationCursor = relationTable.Search(osmIDQueryFilter, false);
                                comReleaser.ManageLifetime(relationCursor);

                                IRow foundRelation = relationCursor.NextRow();

                                if (foundRelation != null)
                                {
                                    // in order to be in the relation table is needs to be a either a super-relation or a mixed type entity (hence hybrid)
                                    testedGeometry = osmRelationGeometryType.osmHybridGeometry;
                                    break;
                                }
                            }
                        }
                    }
                }

                // check if there are any nodes counts other than 2, if there are then we cannot fully "walk" the geometry and it will be considered a line
                if (nodeCountDictionary.Values.Any(e => (e != 2)))
                {
                    testedGeometry = osmRelationGeometryType.osmPolyline;
                }
//.........这里部分代码省略.........
开发者ID:hallahan,项目名称:arcgis-osm-editor,代码行数:101,代码来源:OSMToolHelper.cs

示例4: updateIsMemberOf

        private void updateIsMemberOf(IFeatureClass osmLineFeatureClass, int osmMemberOfPolylineFieldIndex, string osmID, List<string> parentList)
        {
            using (ComReleaser comReleaserInternal = new ComReleaser())
            {
                IQueryFilter lineQueryFilter = new QueryFilterClass();
                lineQueryFilter.WhereClause = osmLineFeatureClass.WhereClauseByExtensionVersion(osmID, "OSMID", 2);
                IFeatureCursor searchCursor = osmLineFeatureClass.Update(lineQueryFilter, false);
                comReleaserInternal.ManageLifetime(searchCursor);

                IFeature featureToModify = searchCursor.NextFeature();
                if (featureToModify != null)
                {
                    List<string> isMemberOfList = _osmUtility.retrieveIsMemberOf(featureToModify, osmMemberOfPolylineFieldIndex);

                    // create a union of both lists
                    List<string> unionedMemberOfList = new List<string>(isMemberOfList.Union(parentList));

                    isMemberOfList.AddRange(unionedMemberOfList);

                    _osmUtility.insertIsMemberOf(osmMemberOfPolylineFieldIndex, unionedMemberOfList, featureToModify);

                    searchCursor.UpdateFeature(featureToModify);

                    if (featureToModify != null)
                        Marshal.ReleaseComObject(featureToModify);
                }
            }
        }
开发者ID:hallahan,项目名称:arcgis-osm-editor,代码行数:28,代码来源:OSMToolHelper.cs

示例5: loadOSMRelations


//.........这里部分代码省略.........

                                                try
                                                {
                                                    //mpFeature.Store();
                                                    polygonFeatureInsertCursor.InsertFeature(polygonFeatureBuffer);
                                                }
                                                catch (Exception ex)
                                                {
                                                    message.AddWarning(ex.Message);
                                                }
                                                #endregion
                                            }
                                            else if (detectedGeometryType == esriGeometryType.esriGeometryPolyline)
                                            {
                                                #region create multipart polyline geometry
                                                //IFeature mpFeature = osmLineFeatureClass.CreateFeature();

                                                IPolyline relationMPPolyline = new PolylineClass();
                                                relationMPPolyline.SpatialReference = ((IGeoDataset)osmLineFeatureClass).SpatialReference;

                                                IGeometryCollection relationPolylineGeometryCollection = relationMPPolyline as IGeometryCollection;

                                                IQueryFilter osmIDQueryFilter = new QueryFilterClass();
                                                object missing = Type.Missing;

                                                // loop through the
                                                foreach (KeyValuePair<string, string> wayKey in wayList)
                                                {
                                                    if (TrackCancel.Continue() == false)
                                                    {
                                                        return missingRelations;
                                                    }

                                                    osmIDQueryFilter.WhereClause = osmLineFeatureClass.WhereClauseByExtensionVersion(wayKey.Key, "OSMID", 2);

                                                    System.Diagnostics.Debug.WriteLine("Relation (Polyline) #: " + relationDebugCount + " :___: " + currentRelation.id + " :___: " + wayKey);

                                                    using (ComReleaser relationComReleaser = new ComReleaser())
                                                    {
                                                        IFeatureCursor featureCursor = osmLineFeatureClass.Search(osmIDQueryFilter, false);
                                                        relationComReleaser.ManageLifetime(featureCursor);

                                                        IFeature partFeature = featureCursor.NextFeature();

                                                        // set the appropriate field attribute to become invisible as a standalone features
                                                        if (partFeature != null)
                                                        {
                                                            if (partFeature.Shape.IsEmpty == false)
                                                            {
                                                                IGeometryCollection pathCollection = partFeature.Shape as IGeometryCollection;
                                                                relationPolylineGeometryCollection.AddGeometry(pathCollection.get_Geometry(0), ref missing, ref missing);

                                                                if (osmSupportingElementPolylineFieldIndex > -1)
                                                                {
                                                                    if (!_osmUtility.DoesHaveKeys(partFeature, tagCollectionPolylineFieldIndex, null))
                                                                    {
                                                                        partFeature.set_Value(osmSupportingElementPolylineFieldIndex, "yes");
                                                                    }
                                                                }

                                                                partFeature.Store();
                                                            }
                                                        }
                                                    }
                                                }
开发者ID:hallahan,项目名称:arcgis-osm-editor,代码行数:66,代码来源:OSMToolHelper.cs

示例6: determineOSMGeometryType

        //internal List<ESRI.ArcGIS.OSM.OSMClassExtension.tag> MergeTagsFromOuterPolygonToRelation(ESRI.ArcGIS.OSM.OSMClassExtension.relation currentRelation, IFeatureClass polygonFeatureClass)
        //{
        //    Dictionary<string, ESRI.ArcGIS.OSM.OSMClassExtension.tag> mergedTagList = new Dictionary<string, ESRI.ArcGIS.OSM.OSMClassExtension.tag>();
        //    IQueryFilter osmIDQueryFilter = new QueryFilterClass();
        //    try
        //    {
        //        int osmIDPolygonFieldIndex = polygonFeatureClass.FindField("OSMID");
        //        string sqlPolyOSMID = polygonFeatureClass.SqlIdentifier("OSMID");
        //        foreach (var relationItem in currentRelation.Items)
        //        {
        //            if (relationItem is ESRI.ArcGIS.OSM.OSMClassExtension.member)
        //            {
        //                ESRI.ArcGIS.OSM.OSMClassExtension.member currentRelationMember = relationItem as ESRI.ArcGIS.OSM.OSMClassExtension.member;
        //                if (currentRelationMember.role.ToLower().Equals("outer"))
        //                {
        //                    using (ComReleaser comReleaser = new ComReleaser())
        //                    {
        //                        osmIDQueryFilter.WhereClause = sqlPolyOSMID + " = " + [email protected];
        //                        IFeatureCursor featureCursor = polygonFeatureClass.Search(osmIDQueryFilter, false);
        //                        comReleaser.ManageLifetime(featureCursor);
        //                        IFeature foundPolygonFeature = featureCursor.NextFeature();
        //                        if (foundPolygonFeature == null)
        //                            continue;
        //                        tag[] foundTags = OSMUtility.retrieveOSMTags(foundPolygonFeature, osmIDPolygonFieldIndex, ((IDataset)polygonFeatureClass).Workspace);
        //                        foreach (tag currentWayTag in foundTags)
        //                        {
        //                            // first one in wins
        //                            try
        //                            {
        //                                if (!mergedTagList.ContainsKey(currentWayTag.k))
        //                                {
        //                                    mergedTagList.Add(currentWayTag.k, currentWayTag);
        //                                }
        //                            }
        //                            catch { }
        //                        }
        //                    }
        //                }
        //            }
        //            else if (relationItem is tag)
        //            {
        //                tag relationTag = relationItem as tag;
        //                try
        //                {
        //                    if (!mergedTagList.ContainsKey(relationTag.k))
        //                    {
        //                        mergedTagList.Add(relationTag.k, relationTag);
        //                    }
        //                }
        //                catch { }
        //            }
        //        }
        //    }
        //    catch { }
        //    return mergedTagList.Values.ToList();
        //}
        internal osmRelationGeometryType determineOSMGeometryType(IFeatureClass lineFeatureClass, IFeatureClass polygonFeatureClass, ITable relationTable, string osmIDtoFind)
        {
            osmRelationGeometryType determinedGeometryType = osmRelationGeometryType.osmUnknownGeometry;

            try
            {
                IQueryFilter osmIDQueryFilter = new QueryFilterClass();
                osmIDQueryFilter.SubFields = "OSMID";

                using (ComReleaser comReleaser = new ComReleaser())
                {
                    if (lineFeatureClass != null)
                    {
                        osmIDQueryFilter.WhereClause = lineFeatureClass.WhereClauseByExtensionVersion(osmIDtoFind, "OSMID", 2);
                        IFeatureCursor lineFeatureCursor = lineFeatureClass.Search(osmIDQueryFilter, false);
                        comReleaser.ManageLifetime(lineFeatureCursor);

                        IFeature foundLineFeature = lineFeatureCursor.NextFeature();
                        if (foundLineFeature != null)
                        {
                            determinedGeometryType = osmRelationGeometryType.osmPolyline;
                            return determinedGeometryType;
                        }

                        osmIDQueryFilter.WhereClause = polygonFeatureClass.WhereClauseByExtensionVersion(osmIDtoFind, "OSMID", 2);
                        IFeatureCursor polygonFeatureCursor = polygonFeatureClass.Search(osmIDQueryFilter, false);
                        comReleaser.ManageLifetime(polygonFeatureCursor);

                        IFeature foundPolygonFeature = polygonFeatureCursor.NextFeature();
                        if (foundPolygonFeature != null)
                        {
                            determinedGeometryType = osmRelationGeometryType.osmPolygon;
                            return determinedGeometryType;
                        }

                        osmIDQueryFilter.WhereClause = relationTable.WhereClauseByExtensionVersion(osmIDtoFind, "OSMID", 2);
                        ICursor relationCursor = relationTable.Search(osmIDQueryFilter, false);
                        comReleaser.ManageLifetime(relationCursor);

                        IRow foundRelation = relationCursor.NextRow();
                        if (foundRelation != null)
                        {
                            // in order to be in the relation table is needs to be a either a super-relation or a mixed type entity (hence hybrid)
                            determinedGeometryType = osmRelationGeometryType.osmHybridGeometry;
//.........这里部分代码省略.........
开发者ID:hallahan,项目名称:arcgis-osm-editor,代码行数:101,代码来源:OSMToolHelper.cs


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