Пример #1
0
        private void method_3(object sender, ValueChangedEventArgs e)
        {
            IPoint inPoint = RasterAdjustHelper.RasterAdjust.DestPointCollection.get_Point(e.Row);

            try
            {
                if (e.Column == 3)
                {
                    inPoint.X = Convert.ToDouble(e.NewValue);
                }
                else if (e.Column == 4)
                {
                    inPoint.Y = Convert.ToDouble(e.NewValue);
                }
            }
            catch
            {
                return;
            }
            object           before    = Missing.Value;
            IPointCollection newPoints = new Multipoint();

            newPoints.AddPoint(inPoint, ref before, ref before);
            RasterAdjustHelper.RasterAdjust.DestPointCollection.ReplacePointCollection(e.Row, 1, newPoints);
        }
Пример #2
0
        public override bool DeCompose(out IArray iarray_0)
        {
            bool flag;

            iarray_0 = null;
            if (this.m_pGeometry.GeometryType != esriGeometryType.esriGeometryMultipoint)
            {
                flag = false;
            }
            else
            {
                object value = Missing.Value;
                iarray_0 = new Array();
                IPointCollection mPGeometry = this.m_pGeometry as IPointCollection;
                IPoint           point      = null;
                for (int i = 0; i < mPGeometry.PointCount; i++)
                {
                    point = mPGeometry.Point[i];
                    IPointCollection multipointClass = new Multipoint();
                    multipointClass.AddPoint(point, ref value, ref value);
                    iarray_0.Add(multipointClass);
                }
                flag = true;
            }
            return(flag);
        }
Пример #3
0
        public override IGeometry HorizontalMirror(IPoint ipoint_0)
        {
            IPoint    pointClass;
            IGeometry geometry;

            if (this.m_pGeometry.GeometryType != esriGeometryType.esriGeometryPoint)
            {
                object           value           = Missing.Value;
                IPointCollection mPGeometry      = this.m_pGeometry as IPointCollection;
                IPointCollection multipointClass = new Multipoint();
                for (int i = 0; i < mPGeometry.PointCount; i++)
                {
                    IPoint point = mPGeometry.Point[i];
                    pointClass = new ESRI.ArcGIS.Geometry.Point();
                    pointClass.PutCoords(2 * ipoint_0.X - pointClass.X, pointClass.Y);
                    multipointClass.AddPoint(pointClass, ref value, ref value);
                }
                geometry = multipointClass as IGeometry;
            }
            else
            {
                pointClass = new ESRI.ArcGIS.Geometry.Point();
                pointClass.PutCoords(2 * ipoint_0.X - (this.m_pGeometry as IPoint).X, (this.m_pGeometry as IPoint).Y);
                geometry = pointClass;
            }
            return(geometry);
        }
Пример #4
0
 private void method_3(IDisplay idisplay_0, esriViewDrawPhase esriViewDrawPhase_0)
 {
     if ((CmdSelectTopology.m_TopologyGraph == null ? false : this.Enabled))
     {
         IEnumTopologyEdge edgeSelection = CmdSelectTopology.m_TopologyGraph.EdgeSelection;
         edgeSelection.Reset();
         ITopologyEdge topologyEdge = edgeSelection.Next();
         object        value        = Missing.Value;
         if (topologyEdge != null)
         {
             IGeometryCollection polylineClass = new Polyline() as IGeometryCollection;
             while (topologyEdge != null)
             {
                 polylineClass.AddGeometryCollection((IGeometryCollection)topologyEdge.Geometry);
                 topologyEdge = edgeSelection.Next();
             }
             idisplay_0.SetSymbol((ISymbol)this.ilineSymbol_0);
             idisplay_0.DrawPolyline((IGeometry)polylineClass);
         }
         IEnumTopologyNode nodeSelection = CmdSelectTopology.m_TopologyGraph.NodeSelection;
         nodeSelection.Reset();
         ITopologyNode topologyNode = nodeSelection.Next();
         if (topologyNode != null)
         {
             IPointCollection multipointClass = new Multipoint();
             while (topologyNode != null)
             {
                 multipointClass.AddPoint((IPoint)topologyNode.Geometry, ref value, ref value);
                 topologyNode = nodeSelection.Next();
             }
             idisplay_0.SetSymbol((ISymbol)this.imarkerSymbol_0);
             idisplay_0.DrawMultipoint((IGeometry)multipointClass);
         }
     }
 }
Пример #5
0
        public void CanDetermineEqualMultipointXyChangedOrderWithDuplicates()
        {
            Multipoint <IPnt> mp1 = new Multipoint <IPnt>(
                new[]
            {
                new Pnt3D(1234.5678, 9876.54321, 345.6),
                new Pnt3D(234.5678, 987.54321, 355.6),
                new Pnt3D(34.5678, 98.54321, 365.6),
                new Pnt3D(4.5678, 9.54321, 375.6)
            });

            Multipoint <IPnt> mp2 = new Multipoint <IPnt>(mp1.GetPoints(0, null, true).Reverse());

            mp2.AddPoint(new Pnt3D(34.5678, 98.54321, 365.6));

            Assert.IsTrue(GeomRelationUtils.AreMultipointsEqualXY(mp1, mp2, 0.00001));

            mp2 = new Multipoint <IPnt>(mp2.GetPoints(0, null, true).Reverse());

            Assert.IsTrue(GeomRelationUtils.AreMultipointsEqualXY(mp1, mp2, 0.00001));

            mp2.AddPoint(new Pnt3D(34.4678, 98.64321, 365.6));

            Assert.IsFalse(GeomRelationUtils.AreMultipointsEqualXY(mp1, mp2, 0.00001));
            Assert.IsTrue(GeomRelationUtils.AreBoundsEqual(mp1, mp2, 0.000001));
        }
Пример #6
0
        public static IGeometry Mirror(IGeometry igeometry_0, ILine iline_0)
        {
            IGeometry        geometry;
            IPointCollection igeometry0;
            object           value;
            int i;
            IPointCollection polylineClass = null;

            if (igeometry_0 is IPolyline)
            {
                polylineClass = new Polyline();
            }
            else if (!(igeometry_0 is IPolygon))
            {
                if (igeometry_0 is IMultipoint)
                {
                    polylineClass = new Multipoint();
                    igeometry0    = igeometry_0 as IPointCollection;
                    value         = Missing.Value;
                    for (i = 0; i < igeometry0.PointCount; i++)
                    {
                        polylineClass.AddPoint(GeometryOperator.Mirror(igeometry0.Point[i], iline_0), ref value,
                                               ref value);
                    }
                    geometry = polylineClass as IGeometry;
                    return(geometry);
                }
                if (!(igeometry_0 is IPoint))
                {
                    geometry = null;
                    return(geometry);
                }
                else
                {
                    geometry = GeometryOperator.Mirror(igeometry_0 as IPoint, iline_0);
                    return(geometry);
                }
            }
            else
            {
                polylineClass = new Polygon();
            }
            igeometry0 = igeometry_0 as IPointCollection;
            value      = Missing.Value;
            for (i = 0; i < igeometry0.PointCount; i++)
            {
                polylineClass.AddPoint(GeometryOperator.Mirror(igeometry0.Point[i], iline_0), ref value, ref value);
            }
            geometry = polylineClass as IGeometry;
            return(geometry);
        }
Пример #7
0
        public static void RelpacePoint(IPoint ipoint_0, IGeometry igeometry_0, int int_0, int int_1)
        {
            IPointCollection multipointClass = new Multipoint();
            object           value           = Missing.Value;

            multipointClass.AddPoint(ipoint_0, ref value, ref value);
            IPath geometry = (IPath)((IGeometryCollection)igeometry_0).Geometry[int_0];
            bool  isClosed = geometry.IsClosed;

            ((IPointCollection)geometry).ReplacePointCollection(int_1, 1, multipointClass);
            if (isClosed && int_1 == 0)
            {
                ((IPointCollection)geometry).ReplacePointCollection((geometry as IPointCollection).PointCount - 1, 1,
                                                                    multipointClass);
            }
        }
Пример #8
0
        public bool Snap(IGeometry igeometry_0, IPoint ipoint_0, double double_0)
        {
            bool      flag;
            int       i;
            IHitTest  shape;
            IGeometry geometry;

            if (!EditorLicenseProviderCheck.Check())
            {
                flag = false;
            }
            else if (this.ifeatureCache_0.Count != 0)
            {
                bool   flag1      = false;
                double num        = 0;
                int    num1       = 0;
                int    num2       = 0;
                bool   flag2      = true;
                IPoint pointClass = new ESRI.ArcGIS.Geometry.Point();
                object value      = Missing.Value;
                IArray arrayClass = new Array();
                for (i = 0; i < this.ifeatureCache_0.Count; i++)
                {
                    shape = (IHitTest)this.ifeatureCache_0.Feature[i].Shape;
                    if ((shape is IPolyline ? true : shape is IPolygon) &&
                        shape.HitTest(ipoint_0, double_0, esriGeometryHitPartType.esriGeometryPartBoundary, pointClass,
                                      ref num, ref num1, ref num2, ref flag2))
                    {
                        arrayClass.Add(shape);
                    }
                }
                IPointCollection multipointClass = new Multipoint();
                IArray           arrayClass1     = new Array() as IArray;
                for (i = 0; i < arrayClass.Count; i++)
                {
                    ITopologicalOperator2 element = (ITopologicalOperator2)arrayClass.Element[i];
                    for (int j = 0; j < arrayClass.Count; j++)
                    {
                        if (i != j)
                        {
                            if (((IGeometry)arrayClass.Element[i]).GeometryType !=
                                ((IGeometry)arrayClass.Element[j]).GeometryType)
                            {
                                geometry = element.IntersectMultidimension((IGeometry)arrayClass.Element[j]);
                                if (geometry != null)
                                {
                                    IGeometryCollection geometryCollection = geometry as IGeometryCollection;
                                    if (geometryCollection != null)
                                    {
                                        for (int k = 0; k < geometryCollection.GeometryCount; k++)
                                        {
                                            geometry = geometryCollection.Geometry[k];
                                            if (geometry is IPointCollection)
                                            {
                                                multipointClass.AddPointCollection((IPointCollection)geometry);
                                            }
                                            else if (geometry is IPointCollection)
                                            {
                                                multipointClass.AddPoint((IPoint)geometry, ref value, ref value);
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                geometry = element.Intersect((IGeometry)arrayClass.Element[j],
                                                             esriGeometryDimension.esriGeometry0Dimension);
                                if (geometry != null)
                                {
                                    if (geometry is IPointCollection)
                                    {
                                        multipointClass.AddPointCollection((IPointCollection)geometry);
                                    }
                                    else if (geometry is IPointCollection)
                                    {
                                        multipointClass.AddPoint((IPoint)geometry, ref value, ref value);
                                    }
                                }
                            }
                        }
                    }
                }
                shape = (IHitTest)multipointClass;
                if (shape.HitTest(ipoint_0, double_0, esriGeometryHitPartType.esriGeometryPartVertex, pointClass,
                                  ref num, ref num1, ref num2, ref flag2))
                {
                    ipoint_0.PutCoords(pointClass.X, pointClass.Y);
                    flag1 = true;
                }
                flag = flag1;
            }
            else
            {
                flag = false;
            }
            return(flag);
        }
Пример #9
0
        private static List <IPolyline> GetFeatureIntersection(IFeature feature, IPolyline polyline)
        {
            var resultPolylines = new List <IPolyline>();
            var multipoint      = new Multipoint();

            IGeometry geometry = feature.ShapeCopy;

            geometry.Project(polyline.SpatialReference);

            ITopologicalOperator pTopo = geometry as ITopologicalOperator;

            var result = pTopo.Intersect(polyline, esriGeometryDimension.esriGeometry0Dimension);
            var firstLinePointOnLayer = (IPoint)pTopo.Intersect(polyline.FromPoint, esriGeometryDimension.esriGeometry0Dimension);
            var lastLinePointOnLayer  = (IPoint)pTopo.Intersect(polyline.ToPoint, esriGeometryDimension.esriGeometry0Dimension);

            if (!result.IsEmpty)
            {
                multipoint = (Multipoint)result;

                IPoint firstPoint = null;
                IPoint lastPoint  = null;

                if (!firstLinePointOnLayer.IsEmpty)
                {
                    if (firstLinePointOnLayer.Y > multipoint.Point[0].Y)
                    {
                        firstPoint = firstLinePointOnLayer;
                    }
                    else
                    {
                        lastPoint = firstLinePointOnLayer;
                    }
                }

                if (!lastLinePointOnLayer.IsEmpty)
                {
                    if (lastLinePointOnLayer.Y > multipoint.Point[0].Y)
                    {
                        firstPoint = lastLinePointOnLayer;
                    }
                    else
                    {
                        lastPoint = lastLinePointOnLayer;
                    }
                }

                if (firstPoint != null)
                {
                    var buff = new Multipoint();
                    buff.AddPointCollection(multipoint);

                    multipoint.RemovePoints(0, multipoint.PointCount);
                    multipoint.AddPoint(firstPoint);
                    multipoint.AddPointCollection(buff);
                }

                if (lastPoint != null)
                {
                    multipoint.AddPoint(lastPoint);
                }
            }

            if (result.IsEmpty && !firstLinePointOnLayer.IsEmpty)
            {
                if (!firstLinePointOnLayer.IsEmpty)
                {
                    multipoint.AddPoint((IPoint)firstLinePointOnLayer);
                }
                if (!lastLinePointOnLayer.IsEmpty)
                {
                    multipoint.AddPoint((IPoint)lastLinePointOnLayer);
                }
            }

            if (multipoint.PointCount == 1)
            {
                multipoint.Point[0].Project(polyline.SpatialReference);
                resultPolylines.Add(CreatePolylineFromPoints(multipoint.Point[0], multipoint.Point[0]));
            }
            else if (multipoint.PointCount > 0)
            {
                for (int i = 0; i < multipoint.PointCount - 1; i++)
                {
                    multipoint.Point[i].Project(polyline.SpatialReference);
                    multipoint.Point[i + 1].Project(polyline.SpatialReference);

                    resultPolylines.Add(CreatePolylineFromPoints(multipoint.Point[i], multipoint.Point[i + 1]));
                    i++;
                }
            }

            return(resultPolylines);
        }
Пример #10
0
        private void ButtonMatch_Click(object sender, EventArgs e)
        {
            //获取需要匹配的任务需求,所需传感器类型、最大空间分辨率和范围
            string task_id = this.dataGridViewTask.CurrentRow.Cells[0].Value.ToString();

            taskrequirement = dal_taskrequirement.GetModel(Convert.ToDecimal(task_id));
            //taskobsregion = dal_taskobsregion.GetModel(Convert.ToDecimal(task_id));

            decimal MaxSpaceResolution = taskrequirement.SpaceResolution;
            string  SensorsNeeded      = taskrequirement.SensorNeeded;

            string[] SensorsNeeded_split = SensorsNeeded.Split(' ');

            //存储结果的数据集
            DataSet DSSensor1QueryResult = new DataSet();
            //首先要就传感器类型和空间分辨率指标查询观测资源传感器
            string SensorQueryCondition = "";

            SensorQueryCondition += " GeometryResolution<=" + MaxSpaceResolution;
            SensorQueryCondition += " And ( ";

            //根据传感器类型string判断数据库中SensorType中0或1的对应关系,0代表雷达,1代表光学
            int SensorTypeID = GetSensorTypeID(SensorsNeeded_split);

            if (SensorTypeID == 0 || SensorTypeID == 1)
            {
                SensorQueryCondition += "SensorType='" + SensorTypeID.ToString() + "'";
            }
            else if (SensorTypeID == 2)
            {
                SensorQueryCondition += "SensorType='" + "1' " + " or " + "SensorType='" + "0' ";
            }
            SensorQueryCondition += " )";

            //查询
            try
            {
                DSSensor1QueryResult = GetSensor1InfoDataSet(SensorQueryCondition);
            }
            catch (System.Exception ex)
            {
                MessageBox.Show("请输入正确的参数!");
            }
            DataTable DTSensor1 = DSSensor1QueryResult.Tables["SENSOR_1"];

            string whereClause_Band   = "";
            bool   BandTypeConstraint = false;
            string BandTypeNeeded     = "";

            //针对经过空间分辨率和SensorTypeID查出来的传感器列表进行BandType波段类型的查询
            for (int i = DTSensor1.Rows.Count - 1; i >= 0; i--)
            {
                //获取这一条记录的传感器ID
                decimal sensorid = Convert.ToDecimal(DTSensor1.Rows[i]["SensorID"].ToString());
                whereClause_Band = "SensorID=" + sensorid;
                //根据获取的传感器ID,SensorID来获取Sensor_Band_Mode表中所有对应的Band实体
                List <CoScheduling.Core.Model.Sensor_Band_Mode> SensorBandList = dal_sensorbandmode.GetList(whereClause_Band);
                BandTypeConstraint = false;//针对每个传感器都要从默认的false开始判断

                //对每一个观测任务中所需的传感器波段类型,判断已经筛选出的传感器的波段是否能够满足
                for (int j = 0; j < SensorsNeeded_split.Count() - 1; j++)
                {
                    //将观测任务中所需传感器类型的中文表达转换成英文表达
                    BandTypeNeeded = BandTypeTask2Resource(SensorsNeeded_split[j]);


                    //先判断提供的波段类型是否与当前需求的是否一致
                    //如果满足,不用再进行下一个需求波段的判断
                    for (int k = 0; k < SensorBandList.Count; k++)
                    {
                        if (SensorBandList[k].BandType == "PAN" && (BandTypeNeeded.Contains("IS") || BandTypeNeeded.Contains("IR")))
                        {
                            BandTypeConstraint = true;
                            break;
                        }
                        //如果传感器提供的波段类型与任务需求的一个相符,条件满足
                        else if (SensorBandList[k].BandType.Contains(BandTypeNeeded))
                        {
                            BandTypeConstraint = true;
                            break;
                        }
                    }
                    if (BandTypeConstraint == true)
                    {
                        break;
                    }
                }
                //对应传感器,如果不满足波段类型条件,在DataTable中移除
                if (BandTypeConstraint == false)
                {
                    DTSensor1.Rows[i].Delete();
                }
            }
            DTSensor1.AcceptChanges();



            //空间范围约束条件
            string[]      pointcoord       = taskrequirement.PolygonString.Split(';');
            List <IPoint> lstPoint         = new List <IPoint>(pointcoord.Length);
            bool          ObvRegConstraint = false;
            //将taskobsregion中的经纬度范围转化为矩形四个边界点
            int pointcount = pointcoord.Length;

            for (int i = 0; i < pointcount - 1; i++)
            {
                lstPoint.Add(GetFlatCoordinate(Convert.ToDouble(pointcoord[i].Split(',')[0]), Convert.ToDouble(pointcoord[i].Split(',')[1])));
            }
            //将边界点转化成IGeometry的多边形
            IPointCollection PCollection_ObvReg = new Multipoint();

            for (int i = 0; i < lstPoint.Count; i++)
            {
                PCollection_ObvReg.AddPoint(lstPoint[i]);
            }
            IGeometry Polygon_ObvReg = getGeometry(PCollection_ObvReg);

            //对于传感器观测条件进行查询
            for (int i = DTSensor1.Rows.Count - 1; i >= 0; i--)
            {
                decimal platformid = Convert.ToDecimal(DTSensor1.Rows[i]["PLATFORM_ID"].ToString());
                if (platformid.ToString().Length == 5 || (platformid.ToString().Length == 6 && platformid.ToString()[0] == '1'))//卫星
                {
                    ObvRegConstraint = ISMatchSTCondition(lstPoint, platformid, taskrequirement.StartTime, taskrequirement.EndTime);
                }
                else if (platformid.ToString().Length == 6 && (platformid.ToString()[0] == '3' || platformid.ToString()[0] == '2'))//飞艇无人机
                {
                    //计算无人机的覆盖距离
                    uav_range = dal_uav_range.GetModel(platformid);
                    decimal cruisingvelocity = uav_range.CruisingVelocity;
                    decimal cruisingtime     = uav_range.CruisingTime;
                    decimal coverdistance    = cruisingvelocity * 1000 * (cruisingtime / 60);
                    //无人机当前所在地的坐标(State表)
                    state = dal_state.GetModel(platformid);
                    decimal state_lon                 = state.Longitude;
                    decimal state_lat                 = state.Latitude;
                    IPoint  pointpostition            = GetFlatCoordinate(Convert.ToDouble(state_lon), Convert.ToDouble(state_lat));            //基站点的平面坐标
                    decimal distance_basepoint2region = Convert.ToDecimal(GetTwoGeometryDistance(pointpostition as IGeometry, Polygon_ObvReg)); //点到面的距离
                    if (coverdistance >= distance_basepoint2region)
                    {
                        ObvRegConstraint = true;
                    }
                }
                //如果不满足条件,将这一条记录在Sensor1表中删除
                if (ObvRegConstraint == false)
                {
                    DTSensor1.Rows[i].Delete();
                }
            }
            DTSensor1.AcceptChanges();

            //筛选结果的显示
            dataGridViewSensor.AutoGenerateColumns = false;
            this.dataGridViewSensor.DataSource     = DTSensor1;

            getSensorNum();
        }
Пример #11
0
        private IPoint method_8(IPoint ipoint_0, IFeatureCache2 ifeatureCache2_0, double double_0)
        {
            int              i;
            IGeometry        geometry;
            double           num        = 0;
            int              num1       = 0;
            int              num2       = 0;
            bool             flag       = true;
            IPoint           point      = null;
            List <IGeometry> geometries = new List <IGeometry>();

            for (i = 0; i < ifeatureCache2_0.Count; i++)
            {
                IFeature feature = ifeatureCache2_0.Feature[i];
                if ((feature.Shape.GeometryType == esriGeometryType.esriGeometryPolyline
                    ? true
                    : feature.Shape.GeometryType == esriGeometryType.esriGeometryPolygon))
                {
                    IPoint   pointClass = new ESRI.ArcGIS.Geometry.Point();
                    IHitTest shape      = (IHitTest)feature.Shape;
                    if (
                        shape.HitTest(ipoint_0, double_0, esriGeometryHitPartType.esriGeometryPartBoundary, pointClass,
                                      ref num, ref num1, ref num2, ref flag) && num <= double_0)
                    {
                        IGeometryCollection geometryCollection = shape as IGeometryCollection;
                        if (geometryCollection != null)
                        {
                            ISegmentCollection segmentCollection =
                                geometryCollection.Geometry[num1] as ISegmentCollection;
                            if (segmentCollection != null)
                            {
                                //segmentCollection.Segment[num2] is ICircularArc;
                            }
                        }
                    }
                }
            }
            IPointCollection multipointClass = new Multipoint();

            for (i = 0; i < geometries.Count; i++)
            {
                ITopologicalOperator2 item = (ITopologicalOperator2)geometries[i];
                for (int j = 0; j < geometries.Count; j++)
                {
                    if (i != j)
                    {
                        if (geometries[i].GeometryType != geometries[j].GeometryType)
                        {
                            geometry = item.IntersectMultidimension(geometries[j]);
                            if (geometry != null)
                            {
                                IGeometryCollection geometryCollection1 = geometry as IGeometryCollection;
                                if (geometryCollection1 != null)
                                {
                                    for (int k = 0; k < geometryCollection1.GeometryCount; k++)
                                    {
                                        geometry = geometryCollection1.Geometry[k];
                                        if (geometry is IPointCollection)
                                        {
                                            multipointClass.AddPointCollection((IPointCollection)geometry);
                                        }
                                        else if (geometry is IPoint)
                                        {
                                            object value = Missing.Value;
                                            object obj   = Missing.Value;
                                            multipointClass.AddPoint((IPoint)geometry, ref value, ref obj);
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            geometry = item.Intersect(geometries[j], esriGeometryDimension.esriGeometry0Dimension);
                            if (geometry != null)
                            {
                                if (geometry is IPointCollection)
                                {
                                    multipointClass.AddPointCollection((IPointCollection)geometry);
                                }
                                else if (geometry is IPoint)
                                {
                                    object value1 = Missing.Value;
                                    object obj1   = Missing.Value;
                                    multipointClass.AddPoint((IPoint)geometry, ref value1, ref obj1);
                                }
                            }
                        }
                    }
                }
            }
            IHitTest hitTest     = (IHitTest)multipointClass;
            IPoint   pointClass1 = new ESRI.ArcGIS.Geometry.Point();

            if (
                hitTest.HitTest(ipoint_0, double_0, esriGeometryHitPartType.esriGeometryPartVertex, pointClass1, ref num,
                                ref num1, ref num2, ref flag) && num < double_0)
            {
                point = pointClass1;
            }
            return(point);
        }