private CIMRenderer CreateniqueValueRendererForUSStatesUsingDefinition(FeatureLayer featureLayer) { //All of these methods have to be called on the MCT if (Module1.OnUIThread) { throw new CalledOnWrongThreadException(); } // color ramp CIMICCColorSpace colorSpace = new CIMICCColorSpace() { URL = "Default RGB" }; CIMContinuousColorRamp continuousColorRamp = new CIMLinearContinuousColorRamp(); continuousColorRamp.FromColor = CIMColor.CreateRGBColor(255, 255, 100); // yellow continuousColorRamp.ToColor = CIMColor.CreateRGBColor(255, 0, 0); // red continuousColorRamp.ColorSpace = colorSpace; CIMRandomHSVColorRamp randomHSVColorRamp = new CIMRandomHSVColorRamp() { ColorSpace = colorSpace, MinAlpha = 100, MaxAlpha = 100, MinH = 0, MaxH = 360, MinS = 15, MaxS = 30, MinV = 99, MaxV = 100, Seed = 0 }; UniqueValueRendererDefinition uvRendererDef = new UniqueValueRendererDefinition() { ColorRamp = continuousColorRamp, // randomHSVColorRamp, UseDefaultSymbol = true, ValueFields = new List <string> { "TOTPOP2010" } }; //Configure the Renderer using the layer and the contents of the STATENAM //field return(featureLayer.CreateRenderer(uvRendererDef)); }
private CIMRenderer CreateniqueValueRendererForUSHighwaysUsingDefinition(FeatureLayer featureLayer) { //All of these methods have to be called on the MCT if (Module1.OnUIThread) throw new CalledOnWrongThreadException(); // color ramp CIMICCColorSpace colorSpace = new CIMICCColorSpace() { URL = "Default RGB" }; CIMContinuousColorRamp continuousColorRamp = new CIMLinearContinuousColorRamp(); continuousColorRamp.FromColor = CIMColor.CreateRGBColor(0, 0, 255); // yellow continuousColorRamp.ToColor = CIMColor.CreateRGBColor(255, 0, 0); // red continuousColorRamp.ColorSpace = colorSpace; CIMRandomHSVColorRamp randomHSVColorRamp = new CIMRandomHSVColorRamp() { ColorSpace = colorSpace, MinAlpha = 100, MaxAlpha = 100, MinH = 0, MaxH = 360, MinS = 15, MaxS = 30, MinV = 99, MaxV = 100, Seed = 0 }; UniqueValueRendererDefinition uvRendererDef = new UniqueValueRendererDefinition() { ColorRamp = continuousColorRamp, //randomHSVColorRamp, UseDefaultSymbol = true, ValueFields = new string[] {"ROUTE_NUM"} }; //Configure the Renderer using the featureLayer and the contents of the STATENAM //field return featureLayer.CreateRenderer(uvRendererDef); }