AE Raster Classification Rendering

Source: Internet
Author: User

Arcengine the vector data is really handy, the same for raster images can be styled! No contact before, today just need to make a raster image rendering! The following ideas are implemented:

1. Define a series of interfaces for rendering 2. Determine if the image has a histogram created, if not. 3. Define a color sequence that provides a rendering scheme for rendering. 4. Call the Render method for rendering. Here is the code: there are two methods, one is to load the raster data, one is to render, and then in the event to invoke the method to achieve image rendering!        ///GRID classification thematic map        ///        ///Raster layer         public static void Funcolorforraster_classify (Irasterlayer prasterlayer)         {             Irasterclassifycolorramprenderer prclassrend = new Rasterclassifycolorramprenderer () as irasterclassifycolorramprenderer;             Irasterrenderer prrend = prclassrend as irasterrenderer;              Iraster praster = prasterlayer.raster;             irasterbandcollection prbandcol = praster as Irasterbandcollection;            Irasterband prband = PRBandCol.Item (0);             if (Prband.histogram = = null)              {                 prband.computestatsandhist ();            }            Prrend.raster = pRaster;             Prclassrend.classcount = 10;             prrend.update ();              Irgbcolor pfromcolor = new RgbColor () as irgbcolor;             pfromcolor.red = 255;            PfRomcolor.green = 0;            PFromColor.Blue = 0;             Irgbcolor ptocolor = new RgbColor () as irgbcolor; & nbsp;          ptocolor.red = 0;             Ptocolor.green = 0;             Ptocolor.blue = 255;             Ialgorithmiccolorramp Colorramp = new Algorithmiccolorramp () as ialgorithmiccolorramp;             colorramp.size = 10;             Colorramp.fromcolor = pfromcolor;            Colorramp.tocolor = ptocolor;                     BOOL createcolorramp;              Colorramp.createramp (out Createcolorramp);              Ifillsymbol fillsymbol = new Simplefillsymbol () as ifillsymbol;             for (int i = 0; i < Prclassrend.classcount; i++)    & nbsp;        {                 Fillsymbol.color = Colorramp.get_color (i);                 Prclassrend.set_symbol (i, fillsymbol as Isymbol);                 Prclassrend.set_label (i, Prclassrend.get_break (i). ToString ("0.00"));           }            Prasterlayer.renderer = prrend;        }               ///       ///Open Remote Sensing images        //        ///Image address        //Irasterlayer         Private Irasterlayer Openimage (string imagePath)          {            String ws = Path.getdirectoryname (ImagePath);            string FBS = Path.getfilename (ImagePath);             Iworkspacefactory pwork = new Rasterworkspacefactory ();             IrasterworKspace Prasterws = Pwork.openfromfile (ws,0) as irasterworkspace;             Irasterdataset Prasterdataset = Prasterws.openrasterdataset (FBS);                        Irasterlayer Prasterlayer = new Rasterlayer () as irasterlayer;             Prasterlayer.createfromdataset (Prasterdataset);             return prasterlayer;                    the logic of the event: AxMapControl1.Map.AddLayer (Openimage (FilePath)); AxMapControl1.ActiveView.Refresh (); Funcolorforraster_classify (Axmapcontrol1.get_layer (0) as Irasterlayer);//only One RasterLayeraxMapControl1.Activeview.Refresh ();

AE Raster Hierarchical rendering

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.