private void UpdateColorComb() { if (radComponents.Checked) { m_eColorCombinationMethod = EColorCombinationType.enuComponents; cboHue.Enabled = true; cboSatValue.Enabled = true; cboPrimaryColor.Enabled = false; cboSecondaryColor.Enabled = false; } else { m_eColorCombinationMethod = EColorCombinationType.enuCIELabMatrix; cboHue.Enabled = false; cboSatValue.Enabled = false; cboPrimaryColor.Enabled = true; cboSecondaryColor.Enabled = true; } if (m_pSite != null) m_pSite.PageChanged(); m_PageIsDirty = true; }
public void Load(IVariantStream Stream) { //load the persisted parameters of the renderer m_eColorCombinationMethod = (EColorCombinationType)Stream.Read(); m_pShapePatternRend = Stream.Read() as IFeatureRenderer; m_pColorRend1 = Stream.Read() as IFeatureRenderer; m_pColorRend2 = Stream.Read() as IFeatureRenderer; m_pSizeRend = Stream.Read() as IFeatureRenderer; //m_pLegendGroups = = Stream.Read m_sRotationField = (string)Stream.Read(); m_eRotationType = (esriSymbolRotationType)Stream.Read(); m_sTransparencyField = (String)Stream.Read(); m_pMainRend = Stream.Read() as IFeatureRenderer; //CreateLegend() ' not needed now }
private ESRI.ArcGIS.Display.IColor GetCombinedColor(IColor pColor1, IColor pColor2, EColorCombinationType eCombinationMethod, IColor pOriginColor) { // combines the input colors based on m_eColorCombinationMethod // (11/08/04) -- RGB and enuLabLChColorRamp aren't used by GUI IColor pOutColor = null; long MyOLE_COLOR = 0; // As OLE_COLOR in VB6 IRgbColor pMainRGBColor = null; IRgbColor pVariationRGBColor = null; IRgbColor pMergedRGBColor = null; bool bOK = false; IAlgorithmicColorRamp pAlgorithmicCR = null; // if either of the colors are null, then don't run the color through any algorithm, // instead, just return the other color. if both are null, then return a null color if (pColor1.NullColor) { pOutColor = pColor2; } else if (pColor2.NullColor) { pOutColor = pColor1; } else if (eCombinationMethod == EColorCombinationType.enuComponents) { // HSV components // create a new HSV color IHsvColor pHSVDrawColor = null; pHSVDrawColor = new HsvColor(); // get HSV values from Color1 and Color2 and assign to pHSVDrawColor IHsvColor pHSVColor1 = null; IHsvColor pHSVColor2 = null; // (new 4/27/04) didn't think I had to do this... //pHSVColor1 = pColor1 //pHSVColor2 = pColor2 pHSVColor1 = new HsvColor(); pHSVColor1.RGB = pColor1.RGB; pHSVColor2 = new HsvColor(); pHSVColor2.RGB = pColor2.RGB; pHSVDrawColor.Hue = pHSVColor1.Hue; pHSVDrawColor.Saturation = pHSVColor2.Saturation; pHSVDrawColor.Value = pHSVColor2.Value; pOutColor = pHSVDrawColor; } else if (eCombinationMethod == EColorCombinationType.enuRGBAverage) { // use additive color model to merge the two colors MyOLE_COLOR = pColor1.RGB; pMainRGBColor = new RgbColor(); pMainRGBColor.RGB = (int)MyOLE_COLOR; MyOLE_COLOR = pColor2.RGB; pVariationRGBColor = new RgbColor(); pVariationRGBColor.RGB = (int)MyOLE_COLOR; // merged color = RGB average of the two colors pMergedRGBColor = new RgbColor(); pMergedRGBColor.Red = (pMainRGBColor.Red + pVariationRGBColor.Red) / 2; pMergedRGBColor.Green = (pMainRGBColor.Green + pVariationRGBColor.Green) / 2; pMergedRGBColor.Blue = (pMainRGBColor.Blue + pVariationRGBColor.Blue) / 2; pOutColor = pMergedRGBColor; } else if ((eCombinationMethod == EColorCombinationType.enuCIELabColorRamp) | (eCombinationMethod == EColorCombinationType.enuLabLChColorRamp)) { // use color ramp and take central color between the two colors pAlgorithmicCR = new AlgorithmicColorRamp(); if (m_eColorCombinationMethod == EColorCombinationType.enuCIELabColorRamp) pAlgorithmicCR.Algorithm = esriColorRampAlgorithm.esriCIELabAlgorithm; else pAlgorithmicCR.Algorithm = esriColorRampAlgorithm.esriLabLChAlgorithm; pAlgorithmicCR.Size = 3; pAlgorithmicCR.FromColor = pColor1; pAlgorithmicCR.ToColor = pColor2; pAlgorithmicCR.CreateRamp(out bOK); pOutColor = pAlgorithmicCR.get_Color(1); // middle color in ramp } else // EColorCombinationType.enuCIELabMatrix { double[] iLab1 = new double[4]; // L, a, b values for Color1 double[] iLab2 = new double[4]; // L, a, b values for Color2 double[] iLabOrig = new double[4]; // L, a, b values for pOriginColor pColor1.GetCIELAB(out iLab1[0], out iLab1[1], out iLab1[2]); pColor2.GetCIELAB(out iLab2[0], out iLab2[1], out iLab2[2]); pOriginColor.GetCIELAB(out iLabOrig[0], out iLabOrig[1], out iLabOrig[2]); double[] iLabOut = new double[4]; // add color1 vector and color2 vector, then subtract the origin color vector iLabOut[0] = iLab1[0] + iLab2[0] - iLabOrig[0]; iLabOut[1] = iLab1[1] + iLab2[1] - iLabOrig[1]; iLabOut[2] = iLab1[2] + iLab2[2] - iLabOrig[2]; CorrectLabOutofRange(ref iLabOut[0], ref iLabOut[1], ref iLabOut[2]); IHsvColor pHSVColor = null; pHSVColor = new HsvColor(); pHSVColor.SetCIELAB(iLabOut[0], iLabOut[1], iLabOut[2]); pOutColor = pHSVColor; } return pOutColor; }
private ESRI.ArcGIS.Display.IColor GetCombinedColor(IColor pColor1, IColor pColor2, EColorCombinationType eCombinationMethod) { return GetCombinedColor(pColor1, pColor2, eCombinationMethod, null); }
public void InitControls(IMultivariateRenderer pMultiRend, IMap pMap, IGeoFeatureLayer pGeoLayer) { // copy properties from the renderer and map to the form m_eColorCombinationMethod = pMultiRend.ColorCombinationMethod; m_pShapePatternRend = pMultiRend.ShapePatternRend; m_pColorRend1 = pMultiRend.ColorRend1; m_pColorRend2 = pMultiRend.ColorRend2; m_pSizeRend = pMultiRend.SizeRend; if (m_pShapePatternRend != null) { chkShapePattern.CheckState = System.Windows.Forms.CheckState.Checked; cboShapePattern.Enabled = true; } if (m_eColorCombinationMethod == EColorCombinationType.enuComponents) { radComponents.Checked = true; radCombination.Checked = false; UpdateColorComb(); } else { //disabled //radComponents.Checked = false; //radCombination.Checked = true; radComponents.Checked = true; radCombination.Checked = false; UpdateColorComb(); } if (m_pColorRend1 != null) { chkColor.CheckState = System.Windows.Forms.CheckState.Checked; radComponents.Enabled = true; //disabled //radCombination.Enabled = true; radCombination.Enabled = false; } if (m_pSizeRend != null) { chkSize.CheckState = System.Windows.Forms.CheckState.Checked; cboSize1.Enabled = true; } IRotationRenderer pRotRend = null; pRotRend = pMultiRend as IRotationRenderer; if (pRotRend.RotationField != "") { chkRotation.CheckState = System.Windows.Forms.CheckState.Checked; butRotation.Enabled = true; } //ITransparencyRenderer pTransRend = null; //pTransRend = pMultiRend as ITransparencyRenderer; //if (pTransRend.TransparencyField != "") //{ // chkTransparency.CheckState = System.Windows.Forms.CheckState.Checked; // butTransparency.Enabled = true; //} m_pMap = pMap; m_pCurrentLayer = pGeoLayer; m_pRend = pMultiRend as IFeatureRenderer; // we need this object to support the root transparency dialogs m_PageIsDirty = false; }