Exemple #1
0
        public static List <ShapePoint> GetUnionStationPos(string [] files, CodeCell.AgileMap.Core.Envelope envelope)
        {
            int length = files.Length;

            Feature[]         singleFeatures;
            List <ShapePoint> shapiontsList = new List <ShapePoint>();

            for (int i = 0; i < length; i++)
            {
                singleFeatures = GetMicapsFeatures(files[i], envelope);
                foreach (Feature fea in singleFeatures)
                {
                    ShapePoint pt        = fea.Geometry as ShapePoint;
                    string     stationNo = fea.FieldValues[0];//站点编号
                    if (stationNo == "01009")
                    {
                        continue;
                    }
                    if (!shapiontsList.Contains(pt))
                    {
                        shapiontsList.Add(pt);
                    }
                }
            }
            return(shapiontsList);
        }
Exemple #2
0
        public void AddShpLayer(string strVecName)
        {
            _shpFileHostLayer.AddData(strVecName, null);
            CodeCell.AgileMap.Core.IMap         map  = _shpFileHostLayer.Map as CodeCell.AgileMap.Core.IMap;
            CodeCell.AgileMap.Core.FeatureLayer fetL = map.LayerContainer.Layers[0] as CodeCell.AgileMap.Core.FeatureLayer;
            _curShpLayerName = fetL.Name;
            SimpleMarkerSymbol sym = new SimpleMarkerSymbol(masSimpleMarkerStyle.Circle);

            sym.Size      = new System.Drawing.Size(4, 4);
            fetL.Renderer = new SimpleFeatureRenderer(sym);
            CodeCell.AgileMap.Core.FeatureClass     fetc  = fetL.Class as CodeCell.AgileMap.Core.FeatureClass;
            CodeCell.AgileMap.Core.Envelope         evp   = fetc.FullEnvelope.Clone() as CodeCell.AgileMap.Core.Envelope;
            GeoDo.RSS.Core.DrawEngine.CoordEnvelope cvEvp = new GeoDo.RSS.Core.DrawEngine.CoordEnvelope(evp.MinX, evp.MaxX, evp.MinY, evp.MaxY);
            this.canvasHost1.Canvas.CurrentEnvelope = cvEvp;
            this.canvasHost1.Canvas.Refresh(enumRefreshType.All);
        }
Exemple #3
0
        public static bool SetAOIArugment(string[] fnames, IMonitoringSubProduct msp, bool multiSelect, out CoordEnvelope selectedEnvelope)
        {
            float maxResultion           = 0f;
            IRasterDataProvider prd      = null;
            CoordEnvelope       envelope = new CoordEnvelope(double.MaxValue, double.MinValue, double.MaxValue, double.MinValue);

            GeoDo.Project.ISpatialReference prdSpatialRef = null;
            foreach (string item in fnames)
            {
                try
                {
                    prd          = GeoDataDriver.Open(item) as IRasterDataProvider;
                    maxResultion = Math.Max(maxResultion, prd.ResolutionX);
                    envelope     = envelope.Union(new CoordEnvelope(prd.CoordEnvelope.MinX, prd.CoordEnvelope.MinX + prd.ResolutionX * prd.Width,
                                                                    prd.CoordEnvelope.MinY, prd.CoordEnvelope.MinY + prd.ResolutionY * prd.Height));
                    prdSpatialRef = prd.SpatialRef;
                }
                catch
                {
                    throw new ArgumentException("选择的文件:“" + Path.GetFileName(item) + "”无法进行面积统计。");
                }
                finally
                {
                    if (prd != null)
                    {
                        prd.Dispose();
                        prd = null;
                    }
                }
            }
            Size size = new Size((int)(envelope.Width / maxResultion), (int)(envelope.Height / maxResultion));

            using (frmStatSubRegionTemplates frm = new frmStatSubRegionTemplates(size, envelope, maxResultion))
            {
                frm.listView1.MultiSelect = multiSelect;
                if (prdSpatialRef != null)
                {
                    frm.SpatialRef = prdSpatialRef;
                }
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    //Feature[] features = frm.GetSelectedFeatures();
                    //AOIProvider aoiProvider = new AOIProvider(null);
                    //aoiProvider.GetBitmapIndexes
                    msp.ArgumentProvider.SetArg("AOI", frm.GetFeatureAOIIndex());
                    msp.ArgumentProvider.SetArg("AOIFeatures", frm.GetSelectedFeatures());
                    CodeCell.AgileMap.Core.Envelope env = frm.GetSelectedEnvelope();
                    if (env != null)
                    {
                        selectedEnvelope = new CoordEnvelope(env.MinX, env.MaxX, env.MinY, env.MaxY);
                    }
                    else
                    {
                        selectedEnvelope = null;
                    }
                    return(true);
                }
                else
                {
                    selectedEnvelope = null;
                    return(false);
                }
            }
        }