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


C# IPoint.Project方法代码示例

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


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

示例1: IndexPoint

        public IndexPoint(int sourceFeatureID, int sourcePointIndex, IPoint location)
        {
            this.SourceFeatureID = sourceFeatureID;
            this.SourcePointIndex = sourcePointIndex;

            if (SpatialReferenceHelper.IsBCAlbers(location.SpatialReference) == false)
                location.Project(SpatialReferenceHelper.BCAlbersSpatialReference);

            this.X = location.X;
            this.Y = location.Y;
        }
开发者ID:EAWCS1,项目名称:SUITT,代码行数:11,代码来源:PointCollectionIndex.cs

示例2: JWD2XY

 public static IPoint JWD2XY(IPoint pJWDPoint, int gcsType, int pcsType)
 {
     try
     {
         ISpatialReferenceFactory factory = new SpatialReferenceEnvironmentClass();
         pJWDPoint.SpatialReference = factory.CreateGeographicCoordinateSystem(gcsType);
         pJWDPoint.Project(factory.CreateProjectedCoordinateSystem(pcsType));
         return pJWDPoint;
     }
     catch
     {
         return null;
     }
 }
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:14,代码来源:SpatialReferenceHelper.cs

示例3: SetDynamicValues


//.........这里部分代码省略.........
                                                                        if (boolLayerOrFC)
                                                                        {
                                                                            if (pFS.SelectionSet.Count > 0)
                                                                            {
                                                                                pFS.SelectionSet.Search(sFilter, false, out cCurs);
                                                                                fCursor = cCurs as IFeatureCursor;

                                                                            }
                                                                            else
                                                                            {
                                                                                fCursor = sourceLayer.Search(sFilter, false);
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            fCursor = sourceLayer.FeatureClass.Search(sFilter, false);
                                                                        }

                                                                        sourceFeature = fCursor.NextFeature();
                                                                        nearestFeature = null;

                                                                        proxOp = (IProximityOperator)inFeature.Shape;
                                                                        lastDistance = searchDistance;
                                                                        if (sourceFeature != null)
                                                                        {
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain83"));

                                                                            while (sourceFeature != null)
                                                                            {
                                                                                if (sourceFeature.Class != inFeature.Class)
                                                                                {

                                                                                    IGeometry pTempGeo = sourceFeature.ShapeCopy;
                                                                                    pTempGeo.Project(inFeature.Shape.SpatialReference);

                                                                                    distance = proxOp.ReturnDistance(pTempGeo);
                                                                                    pTempGeo = null;
                                                                                    if (distance <= lastDistance)
                                                                                    {
                                                                                        nearestFeature = sourceFeature;
                                                                                        lastDistance = distance;
                                                                                    }
                                                                                }
                                                                                else if (sourceFeature.Class == inFeature.Class && sourceFeature.OID != inFeature.OID)
                                                                                {

                                                                                    IGeometry pTempGeo = sourceFeature.ShapeCopy;
                                                                                    pTempGeo.Project(inFeature.Shape.SpatialReference);

                                                                                    distance = proxOp.ReturnDistance(pTempGeo);
                                                                                    pTempGeo = null;
                                                                                    if (distance <= lastDistance)
                                                                                    {
                                                                                        nearestFeature = sourceFeature;
                                                                                        lastDistance = distance;
                                                                                    }
                                                                                }
                                                                                sourceFeature = fCursor.NextFeature();
                                                                            }
                                                                        }
                                                                        if (nearestFeature != null)
                                                                        {
                                                                            AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain84") + lastDistance + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorChain85") + nearestFeature.OID);

                                                                            for (int i = 0; i < sourceFieldNums.Length; i++)
                                                                            {
开发者ID:rlwarford,项目名称:local-government-desktop-addins,代码行数:67,代码来源:AttributeAssistantEditorExtension.cs

示例4: getProjectPoint

 /// <summary>
 /// 坐标系转换-----WGS84转投影坐标系 
 /// </summary>
 /// <param name="point">转换前的IPoint</param>
 /// <returns>转换后的IPoint</returns>
 public static IPoint getProjectPoint(IPoint point)
 {
     try
     {
         ISpatialReferenceFactory pSRF = new SpatialReferenceEnvironmentClass();
         point.SpatialReference = pSRF.CreateGeographicCoordinateSystem((int)(esriSRGeoCSType.esriSRGeoCS_WGS1984));
         point.Project(pSRF.CreateProjectedCoordinateSystem((int)(esriSRProjCSType.esriSRProjCS_WGS1984UTM_31N)));
     }
     catch //(Exception e)
     {
         // MessageBox.Show(e.ToString());
     }
     return point;
 }
开发者ID:BNU-Chen,项目名称:3DGlobe,代码行数:19,代码来源:BaseGISTools.cs

示例5: get_MinimumDistance

        public double get_MinimumDistance(IPoint testPoint, out int segmentOID)
        {
            segmentOID = -1;
            testPoint.Project(SpatialReferenceHelper.BCAlbersSpatialReference);
            IProximityOperator theProxOp = (IProximityOperator)testPoint;

            string cell = this.get_GridCell(testPoint.X, testPoint.Y);

            double theReturn = double.MaxValue;
            if (this._index.ContainsKey(cell) == false)
                return theReturn;

            ArrayList theCellContents = (ArrayList)this._index[cell];
            foreach (object index in theCellContents)
            {
                IndexSegment theISeg = (IndexSegment)this._segs[(int)index];
                double d = theProxOp.ReturnDistance(theISeg.Segment);
                if (d < theReturn)
                {
                    theReturn = d;
                    segmentOID = theISeg.SourceFeatureID;
                }
            }

            return theReturn;
        }
开发者ID:EAWCS1,项目名称:SUITT,代码行数:26,代码来源:SegmentCollectionIndex.cs

示例6: 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

示例7: UpdateInputCoordinate

        private void UpdateInputCoordinate(IPoint point)
        {
            var vm = this.DataContext as MainViewModel;

            if (vm == null)
                return;

            var sr = GetSR();

            point.Project(sr);

            vm.InputCoordinate = string.Format("{0:0.0####} {1:0.0####}", point.Y, point.X);
        }
开发者ID:Esri,项目名称:coordinate-conversion-addin-dotnet,代码行数:13,代码来源:DockableWindowCoordinateConversion.xaml.cs

示例8: GCStoPRJ

 private IPoint GCStoPRJ(IPoint pPoint, int GCSType, int PRJType)
 {
     ISpatialReferenceFactory pSRF = new SpatialReferenceEnvironmentClass();
     pPoint.SpatialReference = pSRF.CreateGeographicCoordinateSystem(GCSType);
     pPoint.Project(pSRF.CreateProjectedCoordinateSystem(PRJType));
     return pPoint;
 }
开发者ID:hijushen,项目名称:WindowDemo,代码行数:7,代码来源:Form1.cs

示例9: AddBarrier

		// Add Barrier
		private void AddBarrier(IPoint objPoint)
		{
			// project to Routing projection
			objPoint.Project(m_objSpatialReference);

			// add point from shape to Barriers
			ISMRouterPoint objSMPoint = null;
			objSMPoint = new SMRouterPointClass();

			objSMPoint.X = objPoint.X;
			objSMPoint.Y = objPoint.Y;

			ISMNetBarrier objBarrier = null;
			objBarrier = new SMNetBarrierClass();

			objBarrier.BarrierID = m_nBarriersCount;
			objBarrier.Point = objSMPoint as SMRouterPointClass;

			try
			{
				m_objRouter.Barriers.Add(objBarrier as SMNetBarrier);
			}
			catch (Exception ex)
			{
				m_nBarriersIgnoredCount = m_nBarriersIgnoredCount + 1;
			}

			m_nBarriersCount = m_nBarriersCount + 1;
		}
开发者ID:Esri,项目名称:arcobjects-sdk-community-samples,代码行数:30,代码来源:RoutingForm.cs

示例10: SetDynamicValues


//.........这里部分代码省略.........
                                                                        {
                                                                            if (pFS.SelectionSet.Count > 0)
                                                                            {
                                                                                pFS.SelectionSet.Search(sFilter, false, out cCurs);
                                                                                fCursor = cCurs as IFeatureCursor;

                                                                            }
                                                                            else
                                                                            {
                                                                                fCursor = sourceLayer.Search(sFilter, false);
                                                                            }
                                                                        }
                                                                        else
                                                                        {
                                                                            fCursor = sourceLayer.FeatureClass.Search(sFilter, false);
                                                                        }

                                                                        sourceFeature = fCursor.NextFeature();
                                                                        nearestFeature = null;

                                                                        proxOp = (IProximityOperator)inFeature.Shape;
                                                                        lastDistance = searchDistance;
                                                                        if (sourceFeature != null)
                                                                        {
                                                                            AAState.WriteLine("                  Features Found, looping for closest");

                                                                            while (sourceFeature != null)
                                                                            {
                                                                                if (sourceFeature.Class != inFeature.Class)
                                                                                {

                                                                                    //distance = proxOp.ReturnDistance(sourceFeature.Shape);
                                                                                    IGeometry pTempGeo = sourceFeature.ShapeCopy;
                                                                                    pTempGeo.Project(inFeature.Shape.SpatialReference);

                                                                                    distance = proxOp.ReturnDistance(pTempGeo);
                                                                                    pTempGeo = null;
                                                                                    if (distance <= lastDistance)
                                                                                    {
                                                                                        nearestFeature = sourceFeature;
                                                                                        lastDistance = distance;
                                                                                    }
                                                                                }
                                                                                else if (sourceFeature.Class == inFeature.Class && sourceFeature.OID != inFeature.OID)
                                                                                {
                                                                                    //distance = proxOp.ReturnDistance(sourceFeature.Shape);

                                                                                    IGeometry pTempGeo = sourceFeature.ShapeCopy;
                                                                                    pTempGeo.Project(inFeature.Shape.SpatialReference);

                                                                                    distance = proxOp.ReturnDistance(pTempGeo);
                                                                                    pTempGeo = null;
                                                                                    if (distance <= lastDistance)
                                                                                    {
                                                                                        nearestFeature = sourceFeature;
                                                                                        lastDistance = distance;
                                                                                    }
                                                                                }
                                                                                sourceFeature = fCursor.NextFeature();
                                                                            }
                                                                        }
                                                                        if (nearestFeature != null)
                                                                        {
                                                                            AAState.WriteLine("                  Closest Feature is " + lastDistance + " Away with OID of " + nearestFeature.OID);

                                                                            for (int i = 0; i < sourceFieldNums.Length; i++)
开发者ID:riordabr,项目名称:3d-cities-template,代码行数:67,代码来源:AttributeAssistantEditorExtension.cs

示例11: IsValidUTMSRForPoint

        public bool IsValidUTMSRForPoint(ISpatialReference mapSpatialReference, IPoint wellsite, bool showAlert)
        {
            bool isUtm = false;
            bool isValid = false;
            ISpatialReferenceInfo theInfo = (ISpatialReferenceInfo)mapSpatialReference;

            if (mapSpatialReference is IProjectedCoordinateSystem)
            {
                IProjectedCoordinateSystem theProjCS = (IProjectedCoordinateSystem)mapSpatialReference;
                IGeographicCoordinateSystem theGeogCS = theProjCS.GeographicCoordinateSystem;
                Debug.WriteLine("Name: " + theInfo.Name);

                Regex theRE = new Regex(@"UTM\D+(\d{1,2})([NS])");
                if (theRE.IsMatch(theInfo.Name))
                {
                    isUtm = true;
                    Match theMatch = theRE.Match(theInfo.Name);
                    int theSRZone = Convert.ToInt32(theMatch.Groups[1].Value);
                    string theSRHemi = theMatch.Groups[2].Value;

                    if (wellsite.SpatialReference == null || wellsite.SpatialReference.FactoryCode != mapSpatialReference.FactoryCode)
                        wellsite.Project(mapSpatialReference);

                    IPoint theClone = (IPoint)((IClone)wellsite).Clone();
                    theClone.Project(theGeogCS);
                    int theCalcZone = (int)Math.Floor((theClone.X + 180) / 6);
                    string theCalcHemi = (theClone.Y >= 0) ? "N" : "S";

                    isValid = (Math.Abs(theSRZone - theCalcZone) >= 1) && (theSRHemi.Equals(theCalcHemi));

                    if (showAlert && !isValid)
                    {
                        System.Windows.Forms.MessageBox.Show(
                            "The map projection is the wrong UTM zone."
                            + Environment.NewLine + "Current projection: " + theInfo.Name
                            + Environment.NewLine + "Projection zone and hemisphere: " + theSRZone + " " + theSRHemi
                            + Environment.NewLine + "Calculated zone and hemisphere: " + theCalcZone + " " + theCalcHemi,
                            "Wrong UTM Zone",
                            MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }

            if (showAlert)
            {
                if (!isUtm)
                    System.Windows.Forms.MessageBox.Show(
                        "The map projection needs to be a UTM projection to construct a wellsite box."
                        + Environment.NewLine + "Current projection: " + theInfo.Name,
                        "Invalid Map Projection",
                        MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            return isUtm && isValid;
        }
开发者ID:EAWCS1,项目名称:SUITT,代码行数:55,代码来源:CreateWellsiteBoxCmd.cs

示例12: SetDynamicValues


//.........这里部分代码省略.........
                                                                {
                                                                    AAState.WriteLine("                  Layer Found " + intersectLayerName);
                                                                    if (intersectLayer.FeatureClass != null)
                                                                    {
                                                                        AAState.WriteLine("                  Datasource is valid for " + intersectLayerName);

                                                                        sFilter = new SpatialFilterClass();
                                                                        AAState.WriteLine("                  Checking source Geometry Type");

                                                                        if (inFeature.Shape.GeometryType == esriGeometryType.esriGeometryPoint)
                                                                        {
                                                                            // esriSpatialRelIntersects does not work properly for point intersecting line.
                                                                            // hence expand point envelope (code cribbed from below)
                                                                            try
                                                                            {
                                                                                ISpatialReferenceResolution pSRResolution;

                                                                                pSRResolution = ((sourceLayer.FeatureClass as IGeoDataset).SpatialReference) as ISpatialReferenceResolution;

                                                                                //  sFilter = new SpatialFilterClass();
                                                                                double intTol = pSRResolution.get_XYResolution(false);
                                                                                bool hasXY = ((sourceLayer.FeatureClass as IGeoDataset).SpatialReference).HasXYPrecision();

                                                                                searchEnvelope = new EnvelopeClass();
                                                                                searchEnvelope.XMin = 0 - intTol;
                                                                                searchEnvelope.YMin = 0 - intTol;
                                                                                searchEnvelope.XMax = 0 + intTol;
                                                                                searchEnvelope.YMax = 0 + intTol;
                                                                                searchEnvelope.CenterAt(inFeature.ShapeCopy as IPoint);

                                                                                //searchEnvelope.SpatialReference = ((inFeature.Class as IFeatureClass) as IGeoDataset).SpatialReference;
                                                                                searchEnvelope.SpatialReference = ((inFeature.Class as IFeatureClass) as IGeoDataset).SpatialReference;
                                                                                searchEnvelope.SnapToSpatialReference();
                                                                                searchEnvelope.Project(AAState._editor.Map.SpatialReference);

                                                                                sFilter.Geometry = Globals.Env2Polygon(searchEnvelope);

                                                                            }
                                                                            catch
                                                                            {
                                                                                sFilter.Geometry = inFeature.ShapeCopy;
                                                                            }

                                                                        }
                                                                        else
                                                                        {
                                                                            AAState.WriteLine("                  Geoemetry is not a point, using shape envelope");

                                                                            sFilter.Geometry = inFeature.ShapeCopy;
                                                                        }
                                                                        sFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
                                                                        sFilter.GeometryField = intersectLayer.FeatureClass.ShapeFieldName;
                                                                        AAState.WriteLine("                  Searching " + intersectLayerName + "for intersected feature");

                                                                        fCursor = intersectLayer.FeatureClass.Search(sFilter, true);
                                                                        IFeature intsersectFeature;
                                                                        int idx = 1;
                                                                        while ((intsersectFeature = fCursor.NextFeature()) != null)
                                                                        {
                                                                            AAState.WriteLine("                  Splitting Intersected Feature number: " + idx);
                                                                            idx++;

                                                                            IFeatureEdit featureEdit = intsersectFeature as IFeatureEdit;
                                                                            ISet featset = featureEdit.Split(inFeature.Shape);
                                                                            AAState.WriteLine("                  Adding split features to array to call the AA ext");
开发者ID:riordabr,项目名称:3d-cities-template,代码行数:66,代码来源:Copy+of+AttributeAssistantEditorExtension.cs

示例13: ConstructViewEnvAtPoint

        private IEnvelope ConstructViewEnvAtPoint(IPoint pt, double size)
        {
            IEnvelope theEnv = new EnvelopeClass();
            pt.Project(this.BCAlbersSpatialReference);
            theEnv.LowerLeft = pt;
            theEnv.Width = size;
            theEnv.Height = size;
            theEnv.Project(this.BCAlbersSpatialReference);
            theEnv.CenterAt(pt);

            return theEnv;
        }
开发者ID:EAWCS1,项目名称:SUITT,代码行数:12,代码来源:ErrorManagerCmd.cs


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