Use ArcEngine9.3 to develop raster and vector rendering.
Development environment: arcengine9.3,vs2008.
Features: Raster (Extrude and rank) and vector (simple, unique, grading, scale) rendering.
Development interface.
Figure 1 Main interface
Figure 2 Grid Rendering interface
Figure 3 Vector Rendering interface
Part of the source code:
Press CTRL + C to copy the codepublic void Simplerenderer (Ifeaturelayer featlayer, String fieldName, Icolorramp colorramp) {Igeofeatur Elayer Pgeofeaturelayer = Featlayer as Igeofeaturelayer; Ifeatureclass pfeatureclass = Featlayer.featureclass; Gets the featureclass on the layer ifeaturecursor pfeaturecursor = Pfeatureclass.search (null, FALSE); Iuniquevaluerenderer puniquevaluerenderer = new Uniquevaluerendererclass (); Unique value renderer//Set render Field object Puniquevaluerenderer.fieldcount = 1; Puniquevaluerenderer.set_field (0, FieldName); Isimplefillsymbol Psimfillsymbol = new Simplefillsymbolclass (); Create fill symbol Puniquevaluerenderer.defaultsymbol = (isymbol) Psimfillsymbol; Puniquevaluerenderer.usedefaultsymbol = false; int n = pfeatureclass.featurecount (null); for (int i = 0; i < n; i++) {IFeature pfeature = Pfeaturecursor.nextfeature (); Iclone PSoUrceclone = Psimfillsymbol as Iclone; Isimplefillsymbol Psimplefillsymbol = Psourceclone.clone () as Isimplefillsymbol; String pfeaturevalue = Pfeature.get_value (PFeature.Fields.FindField (FieldName)). ToString (); Puniquevaluerenderer.addvalue (Pfeaturevalue, "", (Isymbol) psimplefillsymbol); }//Set the color for each symbol for (int i = 0; I <= puniquevaluerenderer.valuecount-1; i++) { String XV = Puniquevaluerenderer.get_value (i); if (XV! = "") {Isimplefillsymbol Pnextsymbol = (isimplefillsymbol) puniquevaluerenderer. Get_symbol (XV); Pnextsymbol.color = Colorramp.get_color (127); Puniquevaluerenderer.set_symbol (XV, (Isymbol) pnextsymbol); }} pgeofeaturelayer.renderer = (ifeaturerenderer) puniquevaluerenderer; } public void Uniquerenderer (Ifeaturelayer featlayer, StrinG FieldName, Icolorramp colorramp) {Igeofeaturelayer Pgeofeaturelayer = Featlayer as Igeofeaturelayer; Ifeatureclass pfeatureclass = Featlayer.featureclass; Gets the featureclass on the layer ifeaturecursor pfeaturecursor = Pfeatureclass.search (null, FALSE); Iuniquevaluerenderer puniquevaluerenderer = new Uniquevaluerendererclass (); Unique value renderer//Set render Field object Puniquevaluerenderer.fieldcount = 1; Puniquevaluerenderer.set_field (0, FieldName); Isimplefillsymbol Psimfillsymbol = new Simplefillsymbolclass (); Create fill symbol Puniquevaluerenderer.defaultsymbol = (isymbol) Psimfillsymbol; Puniquevaluerenderer.usedefaultsymbol = false; int n = pfeatureclass.featurecount (null); for (int i = 0; i < n; i++) {IFeature pfeature = Pfeaturecursor.nextfeature (); Iclone Psourceclone = Psimfillsymbol as Iclone; IsimPlefillsymbol Psimplefillsymbol = Psourceclone.clone () as Isimplefillsymbol; String pfeaturevalue = Pfeature.get_value (PFeature.Fields.FindField (FieldName)). ToString (); Puniquevaluerenderer.addvalue (Pfeaturevalue, "", (Isymbol) psimplefillsymbol); }//Set the color for each symbol for (int i = 0; I <= puniquevaluerenderer.valuecount-1; i++) { String XV = Puniquevaluerenderer.get_value (i); if (XV! = "") {Isimplefillsymbol Pnextsymbol = (isimplefillsymbol) puniquevaluerenderer. Get_symbol (XV); Pcolor = Ramp.get_color (J * (ramp. Size-1)/(count-1)); Pnextsymbol.color = Colorramp.get_color (i * (colorramp.size-1)/(puniquevaluerenderer.valuecount-1)); Puniquevaluerenderer.set_symbol (XV, (Isymbol) pnextsymbol); }} pgeofeaturelayer.renderer = (ifeaturerenderer) puniquevaluereNderer; } public void Classrenderer (Ifeaturelayer featlayer, String fieldName, Icolorramp colorramp, int count) { Value rating Ibasichistogram pbasichis = new Basictablehistogramclass (); Itablehistogram ptabhis = (itablehistogram) pbasichis; Incidence of poverty iclassifygen pclassify = new Equalintervalclass (); Ptabhis.field = FieldName; Igeofeaturelayer Geolayer = (igeofeaturelayer) Layer; ILayer Layer = (ILayer) Featlayer; ITable PTab = (ITable) Layer; ptabhis.table = PTab; Object Doublearrval, Longarrfreq; Pbasichis.gethistogram (out Doublearrval, out longarrfreq); int nDes = count; Pclassify.classify (Doublearrval, longarrfreq, ref nDes); object classes = Pclassify.classbreaks; Double[] Classnum; Classnum = (double[]) Pclassify.classbreaks; int classcountresult = classnum.getupperbound (0); Iclassbreaksrenderer Prender = new Classbreaksrendererclass (); Prender.breakcount = Classcountresult; Prender.field = FieldName; Isimplefillsymbol Psym; Icolor Pcolor; for (int j = 0; J < Classcountresult; J + +) {Pcolor = Colorramp.get_color (J * (Colorramp.size -1)/(ClassCountResult-1)); Psym = new Simplefillsymbolclass (); Psym.color = Pcolor; Prender.set_symbol (J, (Isymbol) psym); Prender.set_break (J, classnum[j + 1]); Prender.set_label (J, Classnum[j]. ToString ("0.00") + "-" + classnum[j + 1]. ToString ("0.00")); } igeofeaturelayer Pgeolyr = (igeofeaturelayer) Layer; Pgeolyr.renderer = (ifeaturerenderer) Prender; public void Proportionalrenderer (Ifeaturelayer featlayer, String fieldName, Icolorramp Colorramp, double count) {Iproportionalsymbolrenderer PSrender = new Proportionalsymbolrendererclass (); Psrender. Field = FieldName; Psrender. Valueunit = esriunits.esriunknownunits; Psrender. Valuerepresentation = Esrivaluerepresentations.esrivaluerepunknown; Choose the rendered style, with the color minsymbol to fill the content, otherwise no effect isimplemarkersymbol Markersym = new Simplemarkersymbol (); Markersym. Size = count; Markersym. Style = esrisimplemarkerstyle.esrismscircle; Markersym. Color = Colorramp.get_color (127); Psrender. Minsymbol = Markersym as Isymbol; Ifeaturelayer featlayer = Featlayer; Igeofeaturelayer geofeat = Featlayer as Igeofeaturelayer; ICursor cursor = ((ITable) featlayer). Search (null, TRUE); Idatastatistics datastat = new Datastatisticsclass (); Datastat. cursor = cursor; Datastat. Field = fieldname;//must not neglect istatisticsresults statisticsresult; try {statisticsreSult = Datastat. Statistics; Psrender. Mindatavalue = Statisticsresult.minimum + 0.1; Psrender. Maxdatavalue = Statisticsresult.maximum; } catch {MessageBox.Show ("error, selected property is not numeric type! "," Error hint ", MessageBoxButtons.OK, Messageboxicon.asterisk); }////sets the background style ifillsymbol Fillsym = new Simplefillsymbolclass (); Fillsym. Color = GetColor (201, 201, 251); Ilinesymbol linesym = new Simplelinesymbolclass (); Linesym. Width = 1; Fillsym. Outline = Linesym; Psrender. Backgroundsymbol = Fillsym; Psrender. Legendsymbolcount = number of 6;//legend Psrender. Createlegendsymbols ();//Create TOC for Legend Geofeat. Renderer = (ifeaturerenderer) Psrender; }Press CTRL + C to copy the code
Full source Download: Featureandrasterrenderer.rar
Arcengine Grid and Vector rendering (with visual color bands)