Пример #1
0
        private double[] fnClassification(IFeatureLayer pFLayer, decimal NClasses, string strClassifiedField, string ClassifiedMethod)
        {
            IFeatureClass pFClass = pFLayer.FeatureClass;

            //Create Rendering of Mean Value at Target Layer
            int intBreakeCount = Convert.ToInt32(NClasses);

            ITable       pTable = (ITable)pFClass;
            IClassifyGEN pClassifyGEN;

            switch (ClassifiedMethod)
            {
            case "Equal Interval":
                pClassifyGEN = new EqualIntervalClass();
                break;

            case "Geometrical Interval":
                pClassifyGEN = new GeometricalInterval();
                break;

            case "Natural Breaks":
                pClassifyGEN = new NaturalBreaksClass();
                break;

            case "Quantile":
                pClassifyGEN = new QuantileClass();
                break;

            case "StandardDeviation":
                pClassifyGEN = new StandardDeviationClass();
                break;

            default:
                pClassifyGEN = new NaturalBreaksClass();
                break;
            }

            //Need to be changed 1/29/15
            ITableHistogram pTableHistogram = new TableHistogramClass();

            pTableHistogram.Field = strClassifiedField;
            pTableHistogram.Table = pTable;
            IHistogram pHistogram = (IHistogram)pTableHistogram;

            object xVals, frqs;

            pHistogram.GetHistogram(out xVals, out frqs);
            pClassifyGEN.Classify(xVals, frqs, intBreakeCount);
            double[] cb = (double[])pClassifyGEN.ClassBreaks;

            return(cb);
        }
        private void btnOK_Click(object sender, EventArgs e)
        {
            // valida os campos
            if (!this.ValidarCampos())
            {
                return;
            }

            this.Cursor = Cursors.WaitCursor;

            //enviar os parametros pra function do banco
            try
            {
                var incidenciaDoencaEmUnidadeSaude = new DoencaEmUnidadeSaudeRepositorio();


                //retorna uma lista de unidades de saude com incidencia da doença escolhida
                var listaIncidenciaDoencaEmDistritosSanitarios = incidenciaDoencaEmUnidadeSaude.GerarMapaTematicoEmDistritosSanitarios((int)this.cmbDoenca.SelectedValue,
                                                                                                                                       this.dateTPDe.Value.Year, this.dateTPAte.Value.Year);
                listaIncidenciaDoencaEmDistritosSanitarios.Count.ToString();

                //criar a Feature Class
                IFeatureClass featureClass = CreateNewShapeFile(@"C:\Sistemas\GestaoSMS\Files\Mapas\MapaIncidencia" + cmbDoenca.Text + "EmDistritosSanitarios" + DateTime.Now.ToString("ddMMyyyyhhmmss") + ".shp");

                //criar uma feature buffer
                IFeatureBuffer featureBuffer = featureClass.CreateFeatureBuffer();

                //campo nome
                int indexNome = featureClass.FindField("nome");

                //campo incidências
                int indexIncidencia = featureClass.FindField("incidencia");

                //criar um feature cursor com buffer ativado
                IFeatureCursor featureCursor = featureClass.Insert(true);

                foreach (MapaDoencaEmDistritoSanitario incidencia in listaIncidenciaDoencaEmDistritosSanitarios)
                {
                    //passar de Wkb para IGeometry
                    var geometry = WKBToGeometry(incidencia.DistritosSanitarios);

                    //atribuir a geometria ao buffer
                    featureBuffer.Shape = geometry;
                    featureBuffer.set_Value(indexNome, incidencia.Nome);
                    featureBuffer.set_Value(indexIncidencia, incidencia.TotalIncidencias);

                    //inserir a feature na featureclass
                    featureCursor.InsertFeature(featureBuffer);
                }

                featureCursor.Flush();
                Marshal.FinalReleaseComObject(featureCursor);

                try
                {
                    //cria featureLayer
                    IFeatureLayer featureLayer = new FeatureLayerClass();
                    featureLayer.FeatureClass = featureClass;

                    if (featureLayer != null)
                    {
                        //cria a geofeaturelayer
                        IGeoFeatureLayer geoFeatureLayer = (IGeoFeatureLayer)featureLayer;

                        //ativar os Labels
                        //geoFeatureLayer.DisplayAnnotation = true;

                        //tabela dos dados
                        ITable table = (ITable)featureClass;

                        //define o metodo de classificacao
                        IClassifyGEN classifyGEN = new NaturalBreaks();

                        //objetos com array de frequencia de dados e valores dos dados
                        object dataFrequency;
                        object dataValues;

                        //histograma
                        ITableHistogram tableHistogram = new TableHistogramClass();
                        IHistogram      histogram      = (IHistogram)tableHistogram;
                        tableHistogram.Field = "incidencia";
                        tableHistogram.Table = table;
                        histogram.GetHistogram(out dataValues, out dataFrequency);
                        double[] data = dataValues as double[];
                        int[]    freq = dataFrequency as int[];
                        classifyGEN.Classify(data, freq, 5);

                        //Renderer de simbolos proporcionais
                        IClassBreaksRenderer render = new ClassBreaksRenderer();
                        double[]             cb     = (double[])classifyGEN.ClassBreaks;
                        render.Field      = "incidencia";
                        render.BreakCount = 5;
                        //render.MinimumBreak = listaIncidenciaDoencaEmDistritosSanitarios.Min(p => p.TotalIncidencias);
                        render.MinimumBreak = cb[0];

                        //define a escala de cores
                        IRgbColor color1 = new RgbColor();
                        IRgbColor color2 = new RgbColor();
                        color1.Red   = 255;
                        color1.Green = 255;
                        color1.Blue  = 0;
                        color2.Red   = 140;
                        color2.Green = 23;
                        color2.Blue  = 23;

                        IAlgorithmicColorRamp colorRamp = new AlgorithmicColorRamp();
                        colorRamp.FromColor = color1;
                        colorRamp.ToColor   = color2;
                        colorRamp.Algorithm = esriColorRampAlgorithm.esriCIELabAlgorithm;
                        colorRamp.Size      = 5;
                        bool ok;
                        colorRamp.CreateRamp(out ok);
                        IEnumColors enumColors = colorRamp.Colors;
                        enumColors.Reset();

                        IClassBreaksUIProperties uiProperties = (IClassBreaksUIProperties)render;
                        uiProperties.ColorRamp = "Custom";

                        //loop para definir o estilo de cada geometria de distrito sanitario
                        for (int i = 0; i < 5; i++)
                        {
                            if (i != 0)
                            {
                                render.Break[i]          = cb[i + 1];
                                render.Label[i]          = (cb[i] + 1).ToString("0") + " - " + cb[i + 1].ToString("0");
                                uiProperties.LowBreak[i] = cb[i] + 1;
                            }
                            else
                            {
                                render.Break[i]          = cb[i + 1];
                                render.Label[i]          = "0 - " + cb[i + 1].ToString("0");
                                uiProperties.LowBreak[i] = cb[i] + 1;
                            }


                            ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbol();
                            simpleFillSymbol.Color = enumColors.Next();
                            simpleFillSymbol.Style = esriSimpleFillStyle.esriSFSSolid;
                            ISymbol symbolteste = simpleFillSymbol as ISymbol;
                            render.Symbol[i] = (ISymbol)symbolteste;
                        }

                        //carregar o shape no mapa
                        geoFeatureLayer.FeatureClass = featureClass;
                        geoFeatureLayer.Name         = featureClass.AliasName;
                        geoFeatureLayer.Visible      = true;
                        geoFeatureLayer.Renderer     = (IFeatureRenderer)render;
                        ArcMap.Document.FocusMap.AddLayer(geoFeatureLayer);
                    }

                    MessageBox.Show("O mapa de incidência da doença [" + cmbDoenca.Text +
                                    "] nos Distritos Sanitários foi gerado com sucesso!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                catch (Exception ex)
                {
                    MostrarErro(ex);
                    MessageBox.Show("Escolha um período que contenha incidências da doença [" + cmbDoenca.Text + "].", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }

            catch (Exception ex)
            {
                this.MostrarErro(ex);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Пример #3
0
        private void DrawingChoroplethmap(IFeatureLayer pFLayer, string strRenderField, decimal NClasses)
        {
            IFeatureClass pFClass = pFLayer.FeatureClass;

            //Create Rendering of Mean Value at Target Layer
            int intGCBreakeCount = Convert.ToInt32(NClasses);

            IGeoFeatureLayer pGeofeatureLayer;

            IFeatureLayer pflOutput = new FeatureLayerClass();

            pflOutput.FeatureClass = pFClass;
            pflOutput.Name         = strRenderField;
            pflOutput.Visible      = true;

            pGeofeatureLayer = (IGeoFeatureLayer)pflOutput;

            ITable       pTable = (ITable)pFClass;
            IClassifyGEN pClassifyGEN;

            switch (cboGCClassify.Text)
            {
            case "Equal Interval":
                pClassifyGEN = new EqualIntervalClass();
                break;

            case "Geometrical Interval":
                pClassifyGEN = new GeometricalInterval();
                break;

            case "Natural Breaks":
                pClassifyGEN = new NaturalBreaksClass();
                break;

            case "Quantile":
                pClassifyGEN = new QuantileClass();
                break;

            case "StandardDeviation":
                pClassifyGEN = new StandardDeviationClass();
                break;

            default:
                pClassifyGEN = new NaturalBreaksClass();
                break;
            }

            ITableHistogram pTableHistogram = new TableHistogramClass();

            pTableHistogram.Field = strRenderField;
            pTableHistogram.Table = pTable;
            IHistogram pHistogram = (IHistogram)pTableHistogram;

            object xVals, frqs;

            pHistogram.GetHistogram(out xVals, out frqs);
            pClassifyGEN.Classify(xVals, frqs, intGCBreakeCount);

            ClassBreaksRenderer pRender = new ClassBreaksRenderer();

            double[] cb = (double[])pClassifyGEN.ClassBreaks;
            pRender.Field        = strRenderField;
            pRender.BreakCount   = intGCBreakeCount;
            pRender.MinimumBreak = cb[0];

            string strColorRamp = cboColorRamp.Text;

            IEnumColors pEnumColors = MultiPartColorRamp(strColorRamp, intGCBreakeCount);

            pEnumColors.Reset();

            IRgbColor pColorOutline = new RgbColor();

            //Can Change the color in here!
            pColorOutline.Red   = picGCLineColor.BackColor.R;
            pColorOutline.Green = picGCLineColor.BackColor.G;
            pColorOutline.Blue  = picGCLineColor.BackColor.B;
            double dblGCOutlineSize = Convert.ToDouble(nudGCLinewidth.Value);

            ICartographicLineSymbol pOutLines = new CartographicLineSymbol();

            pOutLines.Width = dblGCOutlineSize;
            pOutLines.Color = (IColor)pColorOutline;

            //' use this interface to set dialog properties
            IClassBreaksUIProperties pUIProperties = (IClassBreaksUIProperties)pRender;

            pUIProperties.ColorRamp = "Custom";

            ISimpleFillSymbol pSimpleFillSym;

            //' be careful, indices are different for the diff lists
            for (int j = 0; j < intGCBreakeCount; j++)
            {
                pRender.Break[j]          = cb[j + 1];
                pRender.Label[j]          = Math.Round(cb[j], 2).ToString() + " - " + Math.Round(cb[j + 1], 2).ToString();
                pUIProperties.LowBreak[j] = cb[j];
                pSimpleFillSym            = new SimpleFillSymbolClass();
                pSimpleFillSym.Color      = pEnumColors.Next();
                pSimpleFillSym.Outline    = pOutLines;
                pRender.Symbol[j]         = (ISymbol)pSimpleFillSym;
            }
            pGeofeatureLayer.Renderer = (IFeatureRenderer)pRender;
            mForm.axMapControl1.ActiveView.FocusMap.AddLayer(pGeofeatureLayer);
        }
Пример #4
0
        private static void MapUsingClassbreaksRenderer()
        {
            string layerName = CboLayers.GetSelectedLayer();
            ILayer layer     = GetLayerByName(layerName);

            IFeatureLayer2 fLayer    = layer as IFeatureLayer2;
            string         fieldName = CboFields.GetSelectedField();

            // Get the number of classes
            string selectedClass   = CboClasses.GetSelectedClass();
            int    numberOfClasses = Convert.ToInt32(selectedClass);

            ITableHistogram tableHistogram = new TableHistogramClass();

            tableHistogram.Table = fLayer.FeatureClass as ITable;
            tableHistogram.Field = fieldName;
            IHistogram histo = tableHistogram as IHistogram;
            object     datavalues, datafrequencies;

            histo.GetHistogram(out datavalues, out datafrequencies);

            IClassify classify = new QuantileClass();

            classify.SetHistogramData(datavalues, datafrequencies);
            classify.Classify(ref numberOfClasses);

            if (numberOfClasses <= 1)
            {
                return;
            }

            double[] classBreaks = (double[])classify.ClassBreaks;

            IClassBreaksRenderer render = new ClassBreaksRenderer();

            render.Field        = fieldName;
            render.BreakCount   = numberOfClasses;
            render.MinimumBreak = classBreaks[0];

            // Get the colors
            ICmykColor[] colors = ColorbrewerExtension.GetCmykColors();
            IFillSymbol  fill   = null;

            // Iterate through the colors
            for (int i = 0; i < numberOfClasses; i++)
            {
                fill               = new SimpleFillSymbol();
                fill.Color         = colors[i];
                fill.Outline.Width = 0.5;
                render.Symbol[i]   = fill as ISymbol;
                render.Break[i]    = classBreaks[i + 1];
                render.Label[i]    = string.Format("{0} to {1}", classBreaks[i]
                                                   , classBreaks[i + 1]);
            }

            IGeoFeatureLayer gFLayer = layer as IGeoFeatureLayer;

            gFLayer.Renderer = render as IFeatureRenderer;
            IMxDocument mxDoc = ArcMap.Application.Document as IMxDocument;

            mxDoc.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeography, gFLayer
                                            , mxDoc.ActiveView.Extent);
            mxDoc.UpdateContents();
        }
Пример #5
0
        private void btnApply_Click(object sender, EventArgs e)
        {
            //Choropleth mapping : Exactly same with the function in frmChoroplethwithOverlay HK102915
            string strLayerName = cboSourceLayer.Text;

            if (cboSourceLayer.Text == "" || cboValueField.Text == "" || cboUField.Text == "")
            {
                MessageBox.Show("Assign proper layer and field");
                return;
            }

            int    intLIndex = pSnippet.GetIndexNumberFromLayerName(pActiveView, strLayerName);
            ILayer pLayer    = mForm.axMapControl1.get_Layer(intLIndex);

            IFeatureLayer pFLayer = pLayer as IFeatureLayer;
            IFeatureClass pFClass = pFLayer.FeatureClass;

            //Create Rendering of Mean Value at Target Layer
            int    intGCBreakeCount = Convert.ToInt32(nudGCNClasses.Value);
            string strGCRenderField = cboValueField.Text;

            IGeoFeatureLayer pGeofeatureLayer;

            pGeofeatureLayer = (IGeoFeatureLayer)pFLayer;

            ITable       pTable = (ITable)pFClass;
            IClassifyGEN pClassifyGEN;

            switch (cboGCClassify.Text)
            {
            case "Equal Interval":
                pClassifyGEN = new EqualIntervalClass();
                break;

            case "Geometrical Interval":
                pClassifyGEN = new GeometricalInterval();
                break;

            case "Natural Breaks":
                pClassifyGEN = new NaturalBreaksClass();
                break;

            case "Quantile":
                pClassifyGEN = new QuantileClass();
                break;

            case "StandardDeviation":
                pClassifyGEN = new StandardDeviationClass();
                break;

            default:
                pClassifyGEN = new NaturalBreaksClass();
                break;
            }

            //Need to be changed 1/29/15
            ITableHistogram pTableHistogram = new TableHistogramClass();

            pTableHistogram.Field = strGCRenderField;
            pTableHistogram.Table = pTable;
            IHistogram pHistogram = (IHistogram)pTableHistogram;

            object xVals, frqs;

            pHistogram.GetHistogram(out xVals, out frqs);
            pClassifyGEN.Classify(xVals, frqs, intGCBreakeCount);

            ClassBreaksRenderer pRender = new ClassBreaksRenderer();

            double[] cb = (double[])pClassifyGEN.ClassBreaks;
            pRender.Field        = strGCRenderField;
            pRender.BreakCount   = intGCBreakeCount;
            pRender.MinimumBreak = cb[0];

            //' create our color ramp
            IAlgorithmicColorRamp pColorRamp = new AlgorithmicColorRampClass();

            pColorRamp.Algorithm = esriColorRampAlgorithm.esriCIELabAlgorithm;
            IRgbColor pColor1 = new RgbColor();
            IRgbColor pColor2 = new RgbColor();

            //Can Change the color in here!
            pColor1.Red   = picSymolfrom.BackColor.R;
            pColor1.Green = picSymolfrom.BackColor.G;
            pColor1.Blue  = picSymolfrom.BackColor.B;

            Boolean blnOK = true;

            pColor2.Red          = picSymbolTo.BackColor.R;
            pColor2.Green        = picSymbolTo.BackColor.G;
            pColor2.Blue         = picSymbolTo.BackColor.B;
            pColorRamp.FromColor = pColor1;
            pColorRamp.ToColor   = pColor2;
            pColorRamp.Size      = intGCBreakeCount;
            pColorRamp.CreateRamp(out blnOK);

            IEnumColors pEnumColors = pColorRamp.Colors;

            pEnumColors.Reset();

            IRgbColor pColorOutline = new RgbColor();

            //Can Change the color in here!
            pColorOutline.Red   = picGCLineColor.BackColor.R;
            pColorOutline.Green = picGCLineColor.BackColor.G;
            pColorOutline.Blue  = picGCLineColor.BackColor.B;
            double dblGCOutlineSize = Convert.ToDouble(nudGCLinewidth.Value);

            ICartographicLineSymbol pOutLines = new CartographicLineSymbol();

            pOutLines.Width = dblGCOutlineSize;
            pOutLines.Color = (IColor)pColorOutline;

            //' use this interface to set dialog properties
            IClassBreaksUIProperties pUIProperties = (IClassBreaksUIProperties)pRender;

            pUIProperties.ColorRamp = "Custom";

            ISimpleFillSymbol pSimpleFillSym;

            //' be careful, indices are different for the diff lists
            for (int j = 0; j < intGCBreakeCount; j++)
            {
                pRender.Break[j]          = cb[j + 1];
                pRender.Label[j]          = Math.Round(cb[j], 2).ToString() + " - " + Math.Round(cb[j + 1], 2).ToString();
                pUIProperties.LowBreak[j] = cb[j];
                pSimpleFillSym            = new SimpleFillSymbolClass();
                pSimpleFillSym.Color      = pEnumColors.Next();
                pSimpleFillSym.Outline    = pOutLines;
                pRender.Symbol[j]         = (ISymbol)pSimpleFillSym;
            }
            pGeofeatureLayer.Renderer = (IFeatureRenderer)pRender;


            //////////////////The Robustness
            int    intRoundingDigits   = 2;
            int    intUncernBreakCount = Convert.ToInt32(nudTeNClasses.Value);
            string strUncerFieldName   = cboUField.Text;

            int intUncernIdx = pFClass.FindField(strUncerFieldName);
            int intValueIdx  = pFClass.FindField(strGCRenderField);

            //Calculate Robustness
            //Add fld
            int    intTempfldIdx  = 0;
            string strTempfldName = txtFldName.Text;

            if (chkRobustness.Checked)
            {
                if (pFClass.FindField(strTempfldName) == -1)
                {
                    AddField(pFClass, strTempfldName);
                }
                intTempfldIdx = pFClass.FindField(strTempfldName);
            }

            Chart pChart = new Chart();

            IFeature pFeat = null;
            //IFeatureCursor pFCursor = pFClass.Search(null, false);
            IFeatureCursor pFCursor = null;

            if (chkRobustness.Checked)
            {
                pFCursor = pFClass.Update(null, false);
            }
            else
            {
                pFCursor = pFClass.Search(null, false);
            }

            pFeat = pFCursor.NextFeature();
            double[] arrRobustness = new double[pFClass.FeatureCount(null)];

            int i = 0;

            while (pFeat != null)
            {
                for (int j = 0; j < (cb.Length - 1); j++)
                {
                    double dblValue = Convert.ToDouble(pFeat.get_Value(intValueIdx));
                    double dblStd   = Convert.ToDouble(pFeat.get_Value(intUncernIdx));
                    if (j == 0)
                    {
                        if (dblValue >= cb[j] && dblValue <= cb[j + 1])
                        {
                            double dblUpperZvalue  = (cb[j + 1] - dblValue) / dblStd;
                            double dblUpperConfLev = pChart.DataManipulator.Statistics.NormalDistribution(dblUpperZvalue);
                            double dblLowerZvalue  = (cb[j] - dblValue) / dblStd;
                            double dblLowerConfLev = pChart.DataManipulator.Statistics.NormalDistribution(dblLowerZvalue);
                            arrRobustness[i] = dblUpperConfLev - dblLowerConfLev;
                            if (chkRobustness.Checked)
                            {
                                pFeat.set_Value(intTempfldIdx, arrRobustness[i]);
                            }
                        }
                    }
                    else
                    {
                        if (dblValue > cb[j] && dblValue <= cb[j + 1])
                        {
                            double dblUpperZvalue  = (cb[j + 1] - dblValue) / dblStd;
                            double dblUpperConfLev = pChart.DataManipulator.Statistics.NormalDistribution(dblUpperZvalue);
                            double dblLowerZvalue  = (cb[j] - dblValue) / dblStd;
                            double dblLowerConfLev = pChart.DataManipulator.Statistics.NormalDistribution(dblLowerZvalue);
                            arrRobustness[i] = dblUpperConfLev - dblLowerConfLev;
                            if (chkRobustness.Checked)
                            {
                                pFeat.set_Value(intTempfldIdx, arrRobustness[i]);
                            }
                        }
                    }
                }
                if (chkRobustness.Checked)
                {
                    pFCursor.UpdateFeature(pFeat);
                }

                i++;
                pFeat = pFCursor.NextFeature();
            }

            //Define the intervals (the last class is fixed to 1)
            if (intUncernBreakCount == 1)
            {
                return;
            }

            double[] arrRobustBrks     = new double[intUncernBreakCount + 1];
            double   dblRBrksIntervals = Math.Round(1 / Convert.ToDouble(intUncernBreakCount - 1), intRoundingDigits);

            arrRobustBrks[0] = 0;
            for (int j = 1; j < intUncernBreakCount; j++)
            {
                arrRobustBrks[j] = dblRBrksIntervals * j;
            }
            arrRobustBrks[intUncernBreakCount] = 1;



            IFeatureLayer pflUncern = new FeatureLayerClass();

            pflUncern.FeatureClass = pFClass;
            pflUncern.Name         = "Robustness";
            pflUncern.Visible      = true;

            IGeoFeatureLayer pGFLUncern = (IGeoFeatureLayer)pflUncern;

            pFCursor = pGFLUncern.Search(null, true);
            RobustnessRenderer pRobustnessRenderer = new RobustnessRenderer();

            pRobustnessRenderer.arrRobustBrks       = arrRobustBrks;
            pRobustnessRenderer.arrRobustness       = arrRobustness;
            pRobustnessRenderer.dblAngle            = Convert.ToDouble(nudAngleFrom.Value);
            pRobustnessRenderer.dblFromSep          = Convert.ToDouble(nudSeperationFrom.Value);
            pRobustnessRenderer.dblLinewidth        = Convert.ToDouble(nudTeLinewidth.Value);
            pRobustnessRenderer.dblToSep            = Convert.ToDouble(nudSeperationTo.Value);
            pRobustnessRenderer.intUncernBreakCount = intUncernBreakCount;
            pRobustnessRenderer.pLineColor          = pSnippet.getRGB(picTeLineColor.BackColor.R, picTeLineColor.BackColor.G, picTeLineColor.BackColor.B);
            IQueryFilter pQFilter = new QueryFilterClass();


            pRobustnessRenderer.PrepareFilter(pFClass, pQFilter);
            pRobustnessRenderer.Draw(pFCursor, esriDrawPhase.esriDPSelection, pActiveView.ScreenDisplay, null);
            pRobustnessRenderer.CreateLegend();
            pGFLUncern.Renderer = pRobustnessRenderer;

            pActiveView.FocusMap.AddLayer(pGFLUncern as ILayer);

            mForm.axMapControl1.ActiveView.Refresh();
            mForm.axTOCControl1.Update();
        }