• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# EnvelopeClass类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中EnvelopeClass的典型用法代码示例。如果您正苦于以下问题:C# EnvelopeClass类的具体用法?C# EnvelopeClass怎么用?C# EnvelopeClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EnvelopeClass类属于命名空间,在下文中一共展示了EnvelopeClass类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AddImgScaleBar

        /// <summary>
        /// 图形比例尺
        /// </summary>
        /// <returns></returns>
        public bool AddImgScaleBar()
        {
            IStyleSelector pStyleSelector = new ScaleBarSelectorClass();
            bool m_bOK = pStyleSelector.DoModal(0);
            if (m_bOK == true)
            {
                IScaleBar pScaleBar = pStyleSelector.GetStyle(0) as IScaleBar;

                IEnvelope envelope = new EnvelopeClass();
                envelope.PutCoords(0.2, 0.2, 5, 1);
                ESRI.ArcGIS.esriSystem.IUID uid = new ESRI.ArcGIS.esriSystem.UIDClass();
                uid.Value = "esriCarto.Scalebar";
                IMap pMap = mainPage.ActiveView.FocusMap;
                IGraphicsContainer graphicsContainer = mainPage.ActiveView as IGraphicsContainer;
                IActiveView activeView = mainPage.ActiveView as IActiveView;
                IFrameElement frameElement = graphicsContainer.FindFrame(pMap);
                IMapFrame mapFrame = frameElement as IMapFrame;
                IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(uid as ESRI.ArcGIS.esriSystem.UID, null);
                IMapSurround mapsurround = pScaleBar as IMapSurround;
                mapSurroundFrame.MapSurround = mapsurround;
                IElement element = mapSurroundFrame as IElement;
                element.Geometry = envelope;
                element.Activate(activeView.ScreenDisplay);
                graphicsContainer.AddElement(element, 0);
                IMapSurround mapSurround = mapSurroundFrame.MapSurround;
            }
            return true;
        }
开发者ID:xfgxfg,项目名称:CropWatchField,代码行数:32,代码来源:AddMapSouround.cs


示例2: ExportPictureMyself

        /// <summary>
        /// 导出图片
        /// </summary>
        public void ExportPictureMyself(string fileName)
        {
            IActiveView pActiveView = pagelayout.ActiveView;
            IEnvelope pEnv;
            int iOutputResolution = 600;
            int iScreenResolution = 96;
            int hDC;
            tagRECT exportRECT;
            exportRECT.left = 0;
            exportRECT.top = 0;
            exportRECT.right = pActiveView.ExportFrame.right * (iOutputResolution / iScreenResolution);
            exportRECT.bottom = pActiveView.ExportFrame.bottom * (iOutputResolution / iScreenResolution);

            pEnv = new EnvelopeClass();
            pEnv.PutCoords(exportRECT.left, exportRECT.top, exportRECT.right, exportRECT.bottom);
            IExportFileDialog pExportFileDialog = new ExportFileDialogClass();

            string filename = fileName;
            IExport pExport = new ExportJPEGClass();
            pExport.ExportFileName = filename;
            pExport.Resolution = iOutputResolution;
            pExport.PixelBounds = pEnv;
            hDC = pExport.StartExporting();
            pActiveView.Output(hDC, (int)pExport.Resolution, ref exportRECT, null, null);
            pExport.FinishExporting();
            pExport.Cleanup();
        }
开发者ID:xfgxfg,项目名称:CropWatchField,代码行数:30,代码来源:ExportPictureMessage.cs


示例3: AddLegend

 /// <summary>
 /// 图例
 /// </summary>
 /// <returns></returns>
 public bool AddLegend()
 {
     IGraphicsContainer pGraphicsContainer;
     pGraphicsContainer = mainPage.PageLayout as IGraphicsContainer;
     IMapFrame pFocusMapFrame;
     pFocusMapFrame = pGraphicsContainer.FindFrame(mainPage.ActiveView.FocusMap) as IMapFrame;
     UID u = new UIDClass();
     u.Value = "esriCarto.Legend";
     IMapSurroundFrame pLegendFrame;
     pLegendFrame = pFocusMapFrame.CreateSurroundFrame(u, null);
     IEnvelope pEnvelope;
     pEnvelope = new EnvelopeClass();
     pEnvelope.PutCoords(3, 3, 6, 8);
     IElement pElement;
     pElement = pLegendFrame as IElement;
     pElement.Geometry = pEnvelope;
     ILegendWizard pLegendWizard;
     pLegendWizard = new LegendWizard();
     pLegendWizard.PageLayout = mainPage.PageLayout;
     pLegendWizard.InitialLegendFrame = pLegendFrame;
     bool bOk = pLegendWizard.DoModal(mainPage.hWnd);
     if (bOk == true)
     {
         IElement ele = pLegendWizard.LegendFrame as IElement;
         pGraphicsContainer.AddElement(ele, 0);
         mainPage.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
     }
     return true;
 }
开发者ID:xfgxfg,项目名称:CropWatchField,代码行数:33,代码来源:AddMapSouround-old.cs


示例4: get_extent

        public static ESRI.ArcGIS.Geometry.IEnvelope get_extent(OSGeo.OGR.Envelope ogr_envelope, ISpatialReference sr)
        {
            IEnvelope env = new EnvelopeClass();
            env.PutCoords(ogr_envelope.MinX, ogr_envelope.MinY, ogr_envelope.MaxX, ogr_envelope.MaxY);
            env.SpatialReference = sr;

            return env;
        }
开发者ID:geobabbler,项目名称:arcgis-ogr,代码行数:8,代码来源:ogrplugin_utils.cs


示例5: ccc

 private void ccc(IPoint p)
 {
     IEnvelope pEnvelope = new EnvelopeClass();
     pEnvelope.SetEmpty();
     pEnvelope = pAxMapControl.Extent;
     pEnvelope.CenterAt(p);
     pAxMapControl.Extent = pEnvelope.Envelope;
     pAxMapControl.Refresh();
 }
开发者ID:hijushen,项目名称:WindowDemo,代码行数:9,代码来源:GotoXY.cs


示例6: ClampExtent

 private static IEnvelope ClampExtent(IEnvelope extent)
 {
     EnvelopeClass result = new EnvelopeClass();
     double origin = Math.PI * 6378137;
     result.XMin = Math.Max(extent.XMin, -origin);
     result.YMin = Math.Max(extent.YMin, -origin);
     result.XMax = Math.Min(extent.XMax, origin - 1);
     result.YMax = Math.Min(extent.YMax, origin - 1);
     return result;
 }
开发者ID:NGFieldScope,项目名称:Geoprocessing,代码行数:10,代码来源:UTFGrid.cs


示例7: AddPPGeocodedPoint

        internal void AddPPGeocodedPoint(double lat, double lng)
        {
            // Set the coordinate system of the data frame.
            ArcMap.Document.ActiveView.FocusMap.SpatialReference = DefineGCS(); 
            ArcMap.Document.ActiveView.Refresh();

            IPoint iPoint = new PointClass();
            // Set the coordinate system of your point to match your data frame
            iPoint.SpatialReference = DefineGCS();
            iPoint.X = lng;
            iPoint.Y = lat;

            IMap map = ArcMap.Document.ActiveView as IMap;
            IGraphicsContainer graphicsContainer = (IGraphicsContainer)map; // Explicit Cast
            IElement element = null;

            // set the point color
            IColor pointColor = new RgbColor();
            //pointColor.RGB = 255255255;
            pointColor.RGB = 255000000;

            // Marker symbols
            ESRI.ArcGIS.Display.ISimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbolClass();
            simpleMarkerSymbol.Color = pointColor;
            simpleMarkerSymbol.Outline = true;
            simpleMarkerSymbol.OutlineColor = pointColor;
            simpleMarkerSymbol.Size = 10;
            simpleMarkerSymbol.Style = esriSimpleMarkerStyle.esriSMSCircle;

            // Marker element
            IMarkerElement markerElement = new MarkerElementClass();
            markerElement.Symbol = simpleMarkerSymbol;
            markerElement.Symbol.Color = pointColor;

            element = (IElement)markerElement; // Explicit Cast

            // set the element name
            IElementProperties3 elemProperties = element as IElementProperties3;
            elemProperties.Name = string.Concat(lng, " ,", lat);
            elemProperties.AnchorPoint = esriAnchorPointEnum.esriCenterPoint;

            // Add the element to a graphics container and refresh the ActiveView
            if (!(element == null))
            {
                element.Geometry = iPoint;
                graphicsContainer.AddElement(element, 0);
                IEnvelope envelope = new EnvelopeClass();
                envelope = ArcMap.Document.ActiveView.Extent;
                envelope.CenterAt(iPoint);
                //ArcMap.Document.ActiveView.Extent = envelope;
                //map.MapScale = 2400;
                map.MapScale = 5000;
                ArcMap.Document.ActiveView.Refresh();
            }
        }
开发者ID:ApexGIS,项目名称:developer-support,代码行数:55,代码来源:IElement_test.cs


示例8: toolStripButton1_Click

        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            IEnvelope pEnvelope = new EnvelopeClass();
            IPoint pPoint = new PointClass();
            pPoint.PutCoords(Convert.ToDouble(txtlong.Text), Convert.ToDouble(txtlat.Text));

            pEnvelope = pAxMapControl.Extent;
            pEnvelope.CenterAt(pPoint);
            pAxMapControl.Extent = pEnvelope.Envelope;
            pAxMapControl.FlashShape(pPoint as IGeometry);
            //ccc(pPoint);
            //ddd(pPoint);
        }
开发者ID:hijushen,项目名称:WindowDemo,代码行数:13,代码来源:GotoXY.cs


示例9: ExportMap

 /// <summary>
 /// 保存当前ActiveView为图片
 /// </summary>
 /// <param name="SaveFilePath">图片路径</param>
 /// <param name="ActiveView">Map ActiveView</param>
 public static void ExportMap(string SaveFilePath,IActiveView ActiveView)
 {
     IExport export = ExportBase(SaveFilePath);
     double IScreenResolution = ActiveView.ScreenDisplay.DisplayTransformation.Resolution;
     export.ExportFileName = SaveFilePath;
     export.Resolution = IScreenResolution;
     ESRI.ArcGIS.esriSystem.tagRECT deviceRECT = ActiveView.ExportFrame;
     IEnvelope envelope = new EnvelopeClass();
     deviceRECT.right = deviceRECT.right * 10;
     deviceRECT.bottom = deviceRECT.bottom * 10;
     envelope.PutCoords(deviceRECT.left, deviceRECT.top, deviceRECT.right, deviceRECT.bottom);
     export.PixelBounds = envelope;
     ITrackCancel Cancel=new  ESRI.ArcGIS.Display.CancelTrackerClass();
     ActiveView.Output(export.StartExporting(), (int)IScreenResolution*10, ref deviceRECT, ActiveView.Extent, Cancel);
     export.FinishExporting();
     export.Cleanup();
     //MessageBox.Show("OK");
 }
开发者ID:LooWooTech,项目名称:Traffic,代码行数:23,代码来源:FileHelper.cs


示例10: SelectFeatureByPoint

 public static void SelectFeatureByPoint(IMap map,System.Drawing.Point screenPoint,int pixelTol )
 {
     // Construct select envelope
     tagRECT r;
     r.left = screenPoint.X - pixelTol;
     r.right = screenPoint.X + pixelTol;
     r.top = screenPoint.Y - pixelTol;
     r.bottom = screenPoint.Y + pixelTol;
     IEnvelope hotEnvelope=new EnvelopeClass();
     // Transform for screen to map
     IActiveView activeView=map as IActiveView;
     IDisplayTransformation dispTransf = activeView.ScreenDisplay.DisplayTransformation;
     dispTransf.TransformRect(hotEnvelope, ref r, 5);
     // Create select environment
     hotEnvelope.SpatialReference = map.SpatialReference;
     ISelectionEnvironment selectEnviroment = new SelectionEnvironmentClass();
     selectEnviroment.CombinationMethod = esriSelectionResultEnum.esriSelectionResultNew;
     // Select by shape
     map.SelectByShape(hotEnvelope, selectEnviroment, false);
 }
开发者ID:weigiser,项目名称:AOProjects,代码行数:20,代码来源:MapSelectionHelperClass.cs


示例11: GetEnvelopeFromZoomRowCol

        public static IEnvelope GetEnvelopeFromZoomRowCol(int zoom, int row, int col)
        {
            IEnvelope e = new EnvelopeClass();
            e.SpatialReference = GetSpatialReference(102100);
            IPoint llupperLeftPoint = TileToGeographic(col, row, zoom);
            IPoint lllowerRightPoint = TileToGeographic(col + 1, row + 1, zoom);

            var upperLeftPtWm = WebMercatorUtil.GeographicToWebMercator(llupperLeftPoint.Y, llupperLeftPoint.X);
            IPoint wmUpperLeftPoint = new PointClass();
            wmUpperLeftPoint.X = upperLeftPtWm.X;
            wmUpperLeftPoint.Y = upperLeftPtWm.Y;

            var lowerRightPtWm = WebMercatorUtil.GeographicToWebMercator(lllowerRightPoint.Y, lllowerRightPoint.X);
            IPoint wmLowerRightPoint = new PointClass();
            wmLowerRightPoint.X = lowerRightPtWm.X;
            wmLowerRightPoint.Y = lowerRightPtWm.Y;

            e.UpperLeft = wmUpperLeftPoint;
            e.LowerRight = wmLowerRightPoint;
            return e;
        }
开发者ID:dtsagile,项目名称:arcstache,代码行数:21,代码来源:TileUtil.cs


示例12: SelectFeaturesScreenPoint

        static void SelectFeaturesScreenPoint(IMap pMap, int x, int y, int pixelTol)
        {
            tagRECT r;
            //Construct a small rectangle out of the x,y coordinates' pixel tolerance.
            r.left = x - pixelTol; //Upper left x, top left is 0,0.
            r.top = y - pixelTol; //Upper left y, top left is 0,0.
            r.right = x + pixelTol; //Lower right x, top left is 0,0.
            r.bottom = y + pixelTol; //Lower right y, top left is 0,0.

            //Transform the device rectangle into a geographic rectangle via the display transformation.
            IEnvelope pEnvelope = new EnvelopeClass();
            IActiveView pActiveView = pMap as IActiveView;
            IDisplayTransformation pDisplayTrans = pActiveView.ScreenDisplay.DisplayTransformation;
            pDisplayTrans.TransformRect(pEnvelope, ref r, 5);
            //5 = esriTransformPosition + esriTransformToMap.

            pEnvelope.SpatialReference = pMap.SpatialReference;

            //ISelectionEnvironment pSelectionEnvironment = new SelectionEnvironmentClass();
            //pSelectionEnvironment.CombinationMethod =
            //    esriSelectionResultEnum.esriSelectionResultNew;
            //pMap.SelectByShape(pEnvelope, pSelectionEnvironment, false);
        }
开发者ID:hijushen,项目名称:WindowDemo,代码行数:23,代码来源:Form1.cs


示例13: GetGraphicsExtent

        private IEnvelope GetGraphicsExtent(IActiveView docActiveView)
        {
            IEnvelope GraphicsBounds;
            IEnvelope GraphicsEnvelope;
            IGraphicsContainer oiqGraphicsContainer;
            IPageLayout docPageLayout;
            IDisplay GraphicsDisplay;
            IElement oiqElement;

            GraphicsBounds = new EnvelopeClass();
            GraphicsEnvelope = new EnvelopeClass();
            docPageLayout = docActiveView as IPageLayout;
            GraphicsDisplay = docActiveView.ScreenDisplay;
            oiqGraphicsContainer = docActiveView as IGraphicsContainer;
            oiqGraphicsContainer.Reset();

            oiqElement = oiqGraphicsContainer.Next();
            while (oiqElement != null)
            {
                oiqElement.QueryBounds(GraphicsDisplay, GraphicsEnvelope);
                GraphicsBounds.Union(GraphicsEnvelope);
                oiqElement = oiqGraphicsContainer.Next();
            }

            return GraphicsBounds;
        }
开发者ID:chinasio,项目名称:minegis,代码行数:26,代码来源:CmdExoprtMapAsPicture.cs


示例14: GetLayerExtent

    /// <summary>
    /// get the overall extent of the items in the layer
    /// </summary>
    /// <returns></returns>
		private IEnvelope GetLayerExtent()
		{
      //iterate through all the items in the layers DB and get the bounding envelope
			IEnvelope env = new EnvelopeClass();
			env.SpatialReference = m_spatialRef;
			IPoint point = new PointClass();
			point.SpatialReference = m_spatialRef;
			int symbolCode = 0;
			double symbolSize = 0;
			foreach(DataRow r in m_table.Rows)
			{
				if (r[3] is DBNull || r[4] is DBNull)
					continue;

				point.Y = Convert.ToDouble(r[3]);
				point.X = Convert.ToDouble(r[4]);

				// need to get the symbol size in meters in order to add it to the total layer extent
				if (m_display != null)
				{
					symbolCode = Convert.ToInt32(r[8]);
					symbolSize = Math.Max(GetSymbolSize(m_display, symbolCode), symbolSize);
				}


				env.Union(point.Envelope);
			}

      // Expand the envelope in order to include the size of the symbol
			env.Expand(symbolSize, symbolSize, false);

      //return the layer's extent in the data underlying coordinate system
			return env;
		}
开发者ID:Esri,项目名称:arcobjects-sdk-community-samples,代码行数:38,代码来源:RSSWeatherLayerClass.cs


示例15: ZoomTo

    /// <summary>
    /// Zoom to weather item according to its zipcode
    /// </summary>
    /// <param name="zipCode"></param>
    public void ZoomTo(long zipCode)
    {
      if(null == m_table || null == m_symbolTable )
        return;

      if(null == m_display)
        return;

      //get the record for the requested zipCode
      DataRow r = m_table.Rows.Find(zipCode);
      if(null == r)
        return;

      //get the coordinate of the zipCode
      double lat = Convert.ToDouble(r[3]);
      double lon = Convert.ToDouble(r[4]);

      IPoint point = new PointClass();
      point.X = lon;
      point.Y = lat;
      point.SpatialReference = m_spatialRef;

			if (null != m_mapSpatialRef && m_mapSpatialRef.FactoryCode != m_layerSRFactoryCode)
        point.Project(m_mapSpatialRef);

      int iconCode = Convert.ToInt32(r[8]);
      //find the appropriate symbol record
      DataRow rec = m_symbolTable.Rows.Find(iconCode);
      if(rec == null)
        return;

      //get the icon's dimensions
      int iconWidth = Convert.ToInt32(rec[3]);
      int iconHeight = Convert.ToInt32(rec[4]);

      IDisplayTransformation displayTransformation = ((IScreenDisplay)m_display).DisplayTransformation;

      //Convert the icon coordinate into screen coordinate
      int windowX, windowY;
      displayTransformation.FromMapPoint(point,out windowX, out windowY);
      
      //get the upper left coord
      int ulx, uly;
      ulx = windowX - iconWidth/2;
      uly = windowY - iconHeight/2;
      IPoint ulPnt = displayTransformation.ToMapPoint(ulx, uly);

      //get the lower right coord
      int lrx,lry;
      lrx = windowX + iconWidth/2;
      lry = windowY + iconHeight/2;
      IPoint lrPnt = displayTransformation.ToMapPoint(lrx, lry);
      
      //construct the new extent
      IEnvelope envelope = new EnvelopeClass();
      envelope.PutCoords(ulPnt.X, lrPnt.Y, lrPnt.X, ulPnt.Y);
      envelope.Expand(2,2,false);
      
      //set the new extent and refresh the display
      displayTransformation.VisibleBounds = envelope;

			base.m_bIsCompiledDirty = true;

      ((IScreenDisplay)m_display).Invalidate(null, true, (short)esriScreenCache.esriAllScreenCaches);
      ((IScreenDisplay)m_display).UpdateWindow();
    }
开发者ID:Esri,项目名称:arcobjects-sdk-community-samples,代码行数:70,代码来源:RSSWeatherLayerClass.cs


示例16: get_TipText

    /// <summary>
    /// Map tip text at the specified mouse location.
    /// </summary>
    /// <param name="X"></param>
    /// <param name="Y"></param>
    /// <param name="Tolerance"></param>
    /// <returns></returns>
    public override string get_TipText(double X, double Y, double Tolerance)
    {
      IEnvelope envelope = new EnvelopeClass();
      envelope.PutCoords(X - Tolerance, Y - Tolerance,X + Tolerance, Y + Tolerance);
      
      //reproject the envelope to the datasource doordinate system
			if (null != m_mapSpatialRef && m_mapSpatialRef.FactoryCode != m_layerSRFactoryCode)
      {
        envelope.SpatialReference = m_spatialRef;
        envelope.Project(m_mapSpatialRef);
      }

      double xmin, ymin, xmax, ymax;
      envelope.QueryCoords(out xmin, out ymin, out xmax, out ymax);  
      
      //select all the records within the given extent
      string qry = "LON >= " + xmin.ToString() + " AND LON <= " + xmax.ToString() + " AND Lat >= " + ymin.ToString() + " AND LAT <= " + ymax.ToString();
      DataRow[] rows = m_table.Select(qry);
      if(0 == rows.Length)
        return string.Empty;

      DataRow r = rows[0];
      string zipCode = Convert.ToString(r[1]);
      string cityName = Convert.ToString(r[2]);
      string temperature = Convert.ToString(r[5]);

      return cityName + ", " + zipCode + ", " + temperature + "F";
    }
开发者ID:Esri,项目名称:arcobjects-sdk-community-samples,代码行数:35,代码来源:RSSWeatherLayerClass.cs


示例17: Identify

    /// <summary>
    /// Identifying all the weather items falling within the given envelope
    /// </summary>
    /// <param name="pGeom"></param>
    /// <returns></returns>
    public IArray Identify(IGeometry pGeom)
    {
      IEnvelope intersectEnv = new EnvelopeClass();
      IEnvelope inEnv;
      IArray array = new ArrayClass();

      //get the envelope from the geometry 
      if(pGeom.GeometryType == esriGeometryType.esriGeometryEnvelope)
        inEnv = pGeom.Envelope;
      else
        inEnv = pGeom as IEnvelope;

      //reproject the envelope to the source coordsys
      //this would allow to search directly on the Lat/Lon columns
			if (null != m_spatialRef && m_mapSpatialRef.FactoryCode != m_layerSRFactoryCode && null != inEnv.SpatialReference)
        inEnv.Project(base.m_spatialRef);

      //expand the envelope so that it'll cover the symbol
      inEnv.Expand(4,4,true);

      double xmin, ymin, xmax, ymax;
      inEnv.QueryCoords(out xmin, out ymin, out xmax, out ymax);  
      
      //select all the records within the given extent
      string qry = "LON >= " + xmin.ToString() + " AND LON <= " + xmax.ToString() + " AND Lat >= " + ymin.ToString() + " AND LAT <= " + ymax.ToString();
      DataRow[] rows = m_table.Select(qry);
      if(0 == rows.Length)
        return array;
      
      long zipCode;
      IPropertySet			propSet		= null;
      IIdentifyObj			idObj			= null;
      IIdentifyObject		idObject	= null;
      bool	            bIdentify	= false;

      foreach(DataRow r in rows)
      {
        //get the zipCode
        zipCode = Convert.ToInt64(r["ZIPCODE"]); 
 
        //get the properties of the given item in order to pass it to the identify object
        propSet = this.GetWeatherItem(zipCode);
        if(null != propSet)
        {
          //instantiate the identify object and add it to the array
          idObj = new RSSWeatherIdentifyObject();
          //test whether the layer can be identified
          bIdentify = idObj.CanIdentify((ILayer)this);
          if(bIdentify)
          {
            idObject = idObj as IIdentifyObject;
            idObject.PropertySet = propSet;
            array.Add(idObj);
          }
        }
      }

      //return the array with the identify objects
      return array;
    }
开发者ID:Esri,项目名称:arcobjects-sdk-community-samples,代码行数:65,代码来源:RSSWeatherLayerClass.cs


示例18: DoClassifyHandler

        /*
         *该方法通过纯粹的Arcobject的方式实现最大似然分类        *
         *
         * *
         */
        private byte[] DoClassifyHandler(NameValueCollection boundVariables, JsonObject operationInput, string outputFormat, string requestProperties, out string responseProperties)
        {
            _logger.LogMessage(ServerLogger.msgType.infoDetailed, _soename + ".GetRasterStatistics", 8000, "request received");
            if (!_supportRasterItemAccess)
                throw new ArgumentException("The image service does not have a catalog and does not support this operation");
            responseProperties = null;

            long? objectID;
            long? classCount;
            //case insensitive
            bool found = operationInput.TryGetAsLong("objectID", out objectID);
            if (!found || (objectID == null))
                throw new ArgumentNullException("ObjectID");

            found = operationInput.TryGetAsLong("classnumber", out classCount);
            if (!found || (objectID == null))
                throw new ArgumentNullException("classnumber");
            IRasterCatalogItem rasterCatlogItem = null;
            try
            {
                rasterCatlogItem = _mosaicCatalog.GetFeature((int)objectID) as IRasterCatalogItem;
                if (rasterCatlogItem == null)
                {
                    _logger.LogMessage(ServerLogger.msgType.infoDetailed, _soename + ".GetRasterStatistics", 8000, "request finished with exception");
                    throw new ArgumentException("The input ObjectID does not exist");
                }
            }
            catch
            {
                _logger.LogMessage(ServerLogger.msgType.infoDetailed, _soename + ".GetRasterStatistics", 8000, "request finished with exception");
                throw new ArgumentException("The input ObjectID does not exist");
            }
            JsonObject result = new JsonObject();
            string outputurl = "";
            try
            {

                IRasterDataset pRasterDataSet = rasterCatlogItem.RasterDataset;

                IGeoDataset pGeo = pRasterDataSet as IGeoDataset;

                string inPath = @"D:\arcgisserver\directories\arcgisoutput\imageserver\test2_ImageServer";
                string gsgname = System.DateTime.Now.ToString().Replace("/", "").Replace(":", "").Replace(" ", "") + ".gsg";
                string gsgPath = System.IO.Path.Combine(inPath, gsgname);

                bool bcreatesignaturefile = Classify.CreateSignaturefile(pRasterDataSet, Convert.ToInt32(classCount), gsgPath);
                if (bcreatesignaturefile)
                {
                    IMultivariateOp pMultivarateOp = new RasterMultivariateOpClass();
                    IGeoDataset pGeoDatasetResult = pMultivarateOp.MLClassify(pGeo, gsgPath, false, esriGeoAnalysisAPrioriEnum.esriGeoAnalysisAPrioriEqual, Type.Missing, Type.Missing);

                    IEnvelope pEnvelp = new EnvelopeClass();

                    string outurl = "http://localhost:6080/arcgis/rest/directories/arcgisoutput/imageserver/test2_ImageServer/";
                    pEnvelp.PutCoords(116.56075474, 40.29407147, 116.63105347, 40.34514666);
                    // string dd = ExportImage.ExportLayerImage((IRaster)pGeoDatasetResult, bbox, new string[] { "400", "400" }, outurl, fileDir);
                    outputurl = ExportImage.CreateJPEGFromActiveView((IRaster)pGeoDatasetResult, pEnvelp, outurl, inPath);
                }
            }

            catch
            {

            }
            result.AddString("url", outputurl);
            return Encoding.UTF8.GetBytes(result.ToJson());
        }
开发者ID:xyhxyw,项目名称:DeveloperSumit2014,代码行数:72,代码来源:Image_Services_SOE.cs


示例19: GetTile

        private List<TileInfo> GetTile()
        {
            var schema = _tileSource.Schema;
            IEnvelope pEnvelope = new EnvelopeClass();
            ISpatialReferenceFactory pSpatRefFact = new SpatialReferenceEnvironmentClass();
            pEnvelope.SpatialReference = pSpatRefFact.CreateGeographicCoordinateSystem(4326);
            pEnvelope.XMin = extent[0];
            pEnvelope.XMax = extent[2];
            pEnvelope.YMin = extent[1];
            pEnvelope.YMax = extent[3];

            var env = Projector.ProjectEnvelope(pEnvelope, schema.Srs);

            var mapWidth = 256 * num;
            var mapHeight = 256 * num;
            float resolution = (float)level;

            var centerPoint = env.GetCenterPoint();

            var transform = new Transform(centerPoint, resolution, mapWidth, mapHeight);
            Extent exte = new Extent(pEnvelope.XMin, pEnvelope.YMin, pEnvelope.XMax, pEnvelope.YMax);
            var level1 = Utilities.GetNearestLevel(schema.Resolutions, transform.Resolution);

            var tempExtent = new Extent(12597408.0986328, 2623556.09863281, 12629205.9013672, 2655353.90136719);
            var tiles = schema.GetTilesInView(tempExtent, 10);

            return tiles.ToList();
        }
开发者ID:smileliaohua,项目名称:TrafficSpider,代码行数:28,代码来源:DownloadTask.cs


示例20: SetRasterInterpolationAnalysisEnv

        //
        //����դ���ֵ��������
        //
        public static IInterpolationOp SetRasterInterpolationAnalysisEnv(string rasterpath, double cellsize, IFeatureLayer pFeatLayer)
        {
            object Missing = Type.Missing;
            IWorkspace pWorkspace = UtilityFunction.setRasterWorkspace(rasterpath);
            IInterpolationOp pInterpolationOp = new RasterInterpolationOpClass();
            IRasterAnalysisEnvironment pRsEnv = pInterpolationOp as IRasterAnalysisEnvironment;
            pRsEnv.OutWorkspace = pWorkspace;
            //װ�����
            object objCellSize = cellsize;

            pRsEnv.SetCellSize(esriRasterEnvSettingEnum.esriRasterEnvValue, ref objCellSize);
            IEnvelope pEnv = new EnvelopeClass();
            pEnv.XMin = pFeatLayer.AreaOfInterest.XMin;
            pEnv.XMax = pFeatLayer.AreaOfInterest.XMax;
            pEnv.YMin = pFeatLayer.AreaOfInterest.YMin;
            pEnv.YMax = pFeatLayer.AreaOfInterest.YMax;
            object objExtent = pEnv;
            pRsEnv.SetExtent(esriRasterEnvSettingEnum.esriRasterEnvValue, ref objExtent, ref Missing);
            return pInterpolationOp;
        }
开发者ID:lovelll,项目名称:MyDatapreMenu,代码行数:23,代码来源:UtilityFunction.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Environment类代码示例发布时间:2022-05-24
下一篇:
C# Envelope类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap